[Mlir-commits] [mlir] [mlir] Enable decoupling two kinds of greedy behavior. (PR #104649)
Jacques Pienaar
llvmlistbot at llvm.org
Wed Dec 11 16:32:57 PST 2024
================
@@ -34,3 +37,37 @@ func.func @test_dont_reorder_constants() -> (i32, i32, i32) {
%2 = arith.constant 3 : i32
return %0, %1, %2 : i32, i32, i32
}
+
+func.func @test_dont_fold() -> (i32, i32, i32, i32, i32, i32) {
+ // Test either not folding or deduping constants.
+
+ // CHECK-LABEL: test_dont_fold
+ // CHECK-NOT: arith.constant 0
+ // CHECK-DAG: %[[CST:.+]] = arith.constant 0
+ // CHECK-DAG: %[[CST:.+]] = arith.constant 1
+ // CHECK-DAG: %[[CST:.+]] = arith.constant 2
+ // CHECK-DAG: %[[CST:.+]] = arith.constant 3
+ // CHECK-NEXT: return
+
+ // NOCSE-LABEL: test_dont_fold
+ // NOCSE-DAG: arith.constant 0 : i32
+ // NOCSE-DAG: arith.constant 1 : i32
+ // NOCSE-DAG: arith.constant 2 : i32
+ // NOCSE-DAG: arith.constant 1 : i32
+ // NOCSE-DAG: arith.constant 2 : i32
+ // NOCSE-DAG: arith.constant 3 : i32
----------------
jpienaar wrote:
I was confused for second too :) This is the no CSE case. So we do have folding, just not constant depupe. This is flag Matthias suggested, so these two features are independent.
https://github.com/llvm/llvm-project/pull/104649
More information about the Mlir-commits
mailing list