brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.3 KiB · fb209a9 Raw
65 lines · plain
1// RUN: fir-opt --cfg-conversion="always-execute-loop-body=true" %s | FileCheck %s2// RUN: fir-opt --cfg-conversion %s | FileCheck %s --check-prefix=NOOPT3 4func.func @x(%addr : !fir.ref<index>) {5  %bound = arith.constant 452 : index6  %step = arith.constant 1 : index7  fir.do_loop %iv = %bound to %bound step %step {8    fir.call @y(%addr) : (!fir.ref<index>) -> ()9  }10  return11}12 13func.func private @y(%addr : !fir.ref<index>)14 15 16// CHECK-LABEL:   func @x(17// CHECK-SAME:            %[[VAL_0:.*]]: !fir.ref<index>) {18// CHECK:           %[[VAL_1:.*]] = arith.constant 452 : index19// CHECK:           %[[VAL_2:.*]] = arith.constant 1 : index20// CHECK:           %[[VAL_3:.*]] = arith.subi %[[VAL_1]], %[[VAL_1]] : index21// CHECK:           %[[VAL_4:.*]] = arith.addi %[[VAL_3]], %[[VAL_2]] : index22// CHECK:           %[[VAL_5:.*]] = arith.divsi %[[VAL_4]], %[[VAL_2]] : index23// CHECK:           %[[VAL_6:.*]] = arith.constant 0 : index24// CHECK:           %[[VAL_7:.*]] = arith.cmpi sle, %[[VAL_5]], %[[VAL_6]] : index25// CHECK:           %[[VAL_8:.*]] = arith.constant 1 : index26// CHECK:           %[[VAL_9:.*]] = arith.select %[[VAL_7]], %[[VAL_8]], %[[VAL_5]] : index27// CHECK:           br ^bb1(%[[VAL_1]], %[[VAL_9]] : index, index)28// CHECK:         ^bb1(%[[VAL_10:.*]]: index, %[[VAL_11:.*]]: index):29// CHECK:           %[[VAL_12:.*]] = arith.constant 0 : index30// CHECK:           %[[VAL_13:.*]] = arith.cmpi sgt, %[[VAL_11]], %[[VAL_12]] : index31// CHECK:           cond_br %[[VAL_13]], ^bb2, ^bb332// CHECK:         ^bb2:33// CHECK:           fir.call @y(%[[VAL_0]]) : (!fir.ref<index>) -> ()34// CHECK:           %[[VAL_14:.*]] = arith.addi %[[VAL_10]], %[[VAL_2]] overflow<nsw> : index35// CHECK:           %[[VAL_15:.*]] = arith.constant 1 : index36// CHECK:           %[[VAL_16:.*]] = arith.subi %[[VAL_11]], %[[VAL_15]] : index37// CHECK:           br ^bb1(%[[VAL_14]], %[[VAL_16]] : index, index)38// CHECK:         ^bb3:39// CHECK:           return40// CHECK:         }41// CHECK:         func private @y(!fir.ref<index>)42 43// NOOPT-LABEL:   func @x(44// NOOPT-SAME:            %[[VAL_0:.*]]: !fir.ref<index>) {45// NOOPT:           %[[VAL_1:.*]] = arith.constant 452 : index46// NOOPT:           %[[VAL_2:.*]] = arith.constant 1 : index47// NOOPT:           %[[VAL_3:.*]] = arith.subi %[[VAL_1]], %[[VAL_1]] : index48// NOOPT:           %[[VAL_4:.*]] = arith.addi %[[VAL_3]], %[[VAL_2]] : index49// NOOPT:           %[[VAL_5:.*]] = arith.divsi %[[VAL_4]], %[[VAL_2]] : index50// NOOPT:           br ^bb1(%[[VAL_1]], %[[VAL_5]] : index, index)51// NOOPT:         ^bb1(%[[VAL_6:.*]]: index, %[[VAL_7:.*]]: index):52// NOOPT:           %[[VAL_8:.*]] = arith.constant 0 : index53// NOOPT:           %[[VAL_9:.*]] = arith.cmpi sgt, %[[VAL_7]], %[[VAL_8]] : index54// NOOPT:           cond_br %[[VAL_9]], ^bb2, ^bb355// NOOPT:         ^bb2:56// NOOPT:           fir.call @y(%[[VAL_0]]) : (!fir.ref<index>) -> ()57// NOOPT:           %[[VAL_10:.*]] = arith.addi %[[VAL_6]], %[[VAL_2]] overflow<nsw> : index58// NOOPT:           %[[VAL_11:.*]] = arith.constant 1 : index59// NOOPT:           %[[VAL_12:.*]] = arith.subi %[[VAL_7]], %[[VAL_11]] : index60// NOOPT:           br ^bb1(%[[VAL_10]], %[[VAL_12]] : index, index)61// NOOPT:         ^bb3:62// NOOPT:           return63// NOOPT:         }64// NOOPT:         func private @y(!fir.ref<index>)65