[Mlir-commits] [mlir] [mlir] Enable decoupling two kinds of greedy behavior. (PR #104649)
Mehdi Amini
llvmlistbot at llvm.org
Thu Dec 12 15:04:26 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
----------------
joker-eph wrote:
The comment for fold says:
```
/// Whether this should fold while greedily rewriting. This also disables
/// CSE'ing constants.
bool fold = true;
```
Why aren't we keeping these independent then? Disabling Fold shouldn't disable CSE if the CSE option is true...
https://github.com/llvm/llvm-project/pull/104649
More information about the Mlir-commits
mailing list