[Mlir-commits] [mlir] [mlir] Enable decoupling two kinds of greedy behavior. (PR #104649)

Jacques Pienaar llvmlistbot at llvm.org
Wed Dec 18 14:03:52 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:

Out of date comment, sorry. It is/should be independent. I'll double check now.

https://github.com/llvm/llvm-project/pull/104649


More information about the Mlir-commits mailing list