[Mlir-commits] [mlir] Reland [MLIR][SCF] Sink scf.if from scf.while before region into after region. (PR #169892)

Mehdi Amini llvmlistbot at llvm.org
Fri Nov 28 02:48:23 PST 2025


================
@@ -974,6 +974,43 @@ func.func @replace_if_with_cond3(%arg0 : i1, %arg2: i64) -> (i32, i64) {
 
 // -----
 
+// CHECK-LABEL: @while_move_if_down
+func.func @while_move_if_down() -> i32 {
+  %0 = scf.while () : () -> (i32) {
+    %additional_used_value = "test.get_some_value1" () : () -> (i32)
+    %else_value = "test.get_some_value2" () : () -> (i32)
+    %condition = "test.condition"() : () -> i1
+    %res = scf.if %condition -> (i32) {
+      "test.use1" (%additional_used_value) : (i32) -> ()
+      %then_value = "test.get_some_value3" () : () -> (i32)
----------------
joker-eph wrote:

Can we add a use of a value defined above the while?

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


More information about the Mlir-commits mailing list