aboutsummaryrefslogtreecommitdiff
path: root/flang
diff options
context:
space:
mode:
authorIvan Butygin <ivan.butygin@gmail.com>2022-07-16 12:05:03 +0200
committerIvan Butygin <ivan.butygin@gmail.com>2022-07-22 12:39:17 +0200
commit917e4519bc2ac6fe490953b82c69f7c7a9511dbd (patch)
tree8cc1db6a73a3c744fec3e8d2e6d926156de074cf /flang
parent8de1f04c77af1a6e348157073d9924439b71bf6f (diff)
downloadllvm-917e4519bc2ac6fe490953b82c69f7c7a9511dbd.zip
llvm-917e4519bc2ac6fe490953b82c69f7c7a9511dbd.tar.gz
llvm-917e4519bc2ac6fe490953b82c69f7c7a9511dbd.tar.bz2
[mlir][arith] cmpi: move constant to the right side
Convert arith.cmpi to the canonical form with constants on the right side to simplify further optimizations and open more opportunities for CSE. Differential Revision: https://reviews.llvm.org/D129929
Diffstat (limited to 'flang')
-rw-r--r--flang/test/Fir/boxproc.fir4
-rw-r--r--flang/test/Lower/array-character.f902
-rw-r--r--flang/test/Lower/host-associated.f904
3 files changed, 5 insertions, 5 deletions
diff --git a/flang/test/Fir/boxproc.fir b/flang/test/Fir/boxproc.fir
index 128f6e0..30c293e 100644
--- a/flang/test/Fir/boxproc.fir
+++ b/flang/test/Fir/boxproc.fir
@@ -93,7 +93,7 @@ func.func @_QPtest_proc_dummy_other(%arg0: !fir.boxproc<() -> ()>) {
// CHECK: %[[VAL_4:.*]] = load { ptr, i64 }, ptr %[[VAL_3]], align 8
// CHECK: %[[VAL_5:.*]] = extractvalue { ptr, i64 } %[[VAL_4]], 0
// CHECK: %[[VAL_6:.*]] = extractvalue { ptr, i64 } %[[VAL_4]], 1
-// CHECK: %[[VAL_8:.*]] = icmp slt i64 10, %[[VAL_6]]
+// CHECK: %[[VAL_8:.*]] = icmp sgt i64 %[[VAL_6]], 10
// CHECK: %[[VAL_9:.*]] = select i1 %[[VAL_8]], i64 10, i64 %[[VAL_6]]
// CHECK: call void @llvm.memmove.p0.p0.i64(ptr %[[VAL_0]], ptr %[[VAL_5]], i64 %[[VAL_9]], i1 false)
// CHECK: %[[VAL_10:.*]] = sub i64 10, %[[VAL_9]]
@@ -129,7 +129,7 @@ func.func @_QPtest_proc_dummy_other(%arg0: !fir.boxproc<() -> ()>) {
// CHECK: %[[VAL_27:.*]] = load [1 x i8], ptr %[[VAL_26]], align 1
// CHECK: %[[VAL_29:.*]] = getelementptr [1 x i8], ptr %[[VAL_14]], i64 %[[VAL_18]]
// CHECK: store [1 x i8] %[[VAL_27]], ptr %[[VAL_29]], align 1
-// CHECK: %[[VAL_30:.*]] = icmp slt i64 40, %[[VAL_13]]
+// CHECK: %[[VAL_30:.*]] = icmp sgt i64 %[[VAL_13]], 40
// CHECK: %[[VAL_31:.*]] = select i1 %[[VAL_30]], i64 40, i64 %[[VAL_13]]
// CHECK: call void @llvm.memmove.p0.p0.i64(ptr %[[VAL_0]], ptr %[[VAL_14]], i64 %[[VAL_31]], i1 false)
// CHECK: %[[VAL_32:.*]] = sub i64 40, %[[VAL_31]]
diff --git a/flang/test/Lower/array-character.f90 b/flang/test/Lower/array-character.f90
index 476dae4..82b77fb 100644
--- a/flang/test/Lower/array-character.f90
+++ b/flang/test/Lower/array-character.f90
@@ -22,7 +22,7 @@ subroutine issue(c1, c2)
! CHECK: %[[VAL_16:.*]] = arith.addi %[[VAL_13]], %[[VAL_7]] : index
! CHECK: %[[VAL_17:.*]] = fir.array_coor %[[VAL_11]](%[[VAL_12]]) %[[VAL_16]] typeparams %[[VAL_10]]#1 : (!fir.ref<!fir.array<3x!fir.char<1,?>>>, !fir.shape<1>, index, index) -> !fir.ref<!fir.char<1,?>>
! CHECK: %[[VAL_18:.*]] = fir.array_coor %[[VAL_9]](%[[VAL_12]]) %[[VAL_16]] : (!fir.ref<!fir.array<3x!fir.char<1,4>>>, !fir.shape<1>, index) -> !fir.ref<!fir.char<1,4>>
- ! CHECK: %[[VAL_19:.*]] = arith.cmpi slt, %[[VAL_5]], %[[VAL_10]]#1 : index
+ ! CHECK: %[[VAL_19:.*]] = arith.cmpi sgt, %[[VAL_10]]#1, %[[VAL_5]] : index
! CHECK: %[[VAL_20:.*]] = arith.select %[[VAL_19]], %[[VAL_5]], %[[VAL_10]]#1 : index
! CHECK: %[[VAL_21:.*]] = fir.convert %[[VAL_20]] : (index) -> i64
! CHECK: %[[VAL_22:.*]] = fir.convert %[[VAL_18]] : (!fir.ref<!fir.char<1,4>>) -> !fir.ref<i8>
diff --git a/flang/test/Lower/host-associated.f90 b/flang/test/Lower/host-associated.f90
index aa1f8b0..4dc66cb 100644
--- a/flang/test/Lower/host-associated.f90
+++ b/flang/test/Lower/host-associated.f90
@@ -540,7 +540,7 @@ end subroutine test_proc_dummy_other
! CHECK: %[[VAL_10:.*]] = fir.load %[[VAL_9]] : !fir.ref<!fir.boxchar<1>>
! CHECK: %[[VAL_11:.*]]:2 = fir.unboxchar %[[VAL_10]] : (!fir.boxchar<1>) -> (!fir.ref<!fir.char<1,?>>, index)
! CHECK: %[[VAL_12:.*]] = fir.convert %[[VAL_0]] : (!fir.ref<!fir.char<1,10>>) -> !fir.ref<!fir.char<1,?>>
-! CHECK: %[[VAL_13:.*]] = arith.cmpi slt, %[[VAL_4]], %[[VAL_11]]#1 : index
+! CHECK: %[[VAL_13:.*]] = arith.cmpi sgt, %[[VAL_11]]#1, %[[VAL_4]] : index
! CHECK: %[[VAL_14:.*]] = arith.select %[[VAL_13]], %[[VAL_4]], %[[VAL_11]]#1 : index
! CHECK: %[[VAL_15:.*]] = fir.convert %[[VAL_14]] : (index) -> i64
! CHECK: %[[VAL_16:.*]] = fir.convert %[[VAL_12]] : (!fir.ref<!fir.char<1,?>>) -> !fir.ref<i8>
@@ -607,7 +607,7 @@ end subroutine test_proc_dummy_other
! CHECK: %[[VAL_34:.*]] = arith.subi %[[VAL_25]], %[[VAL_6]] : index
! CHECK: br ^bb1(%[[VAL_33]], %[[VAL_34]] : index, index)
! CHECK: ^bb3:
-! CHECK: %[[VAL_35:.*]] = arith.cmpi slt, %[[VAL_3]], %[[VAL_19]] : index
+! CHECK: %[[VAL_35:.*]] = arith.cmpi sgt, %[[VAL_19]], %[[VAL_3]] : index
! CHECK: %[[VAL_36:.*]] = arith.select %[[VAL_35]], %[[VAL_3]], %[[VAL_19]] : index
! CHECK: %[[VAL_37:.*]] = fir.convert %[[VAL_36]] : (index) -> i64
! CHECK: %[[VAL_38:.*]] = fir.convert %[[VAL_9]] : (!fir.ref<!fir.char<1,?>>) -> !fir.ref<i8>