[Mlir-commits] [mlir] [MLIR] Removing dead values for branches (PR #117501)
M. Zeeshan Siddiqui
llvmlistbot at llvm.org
Wed Dec 4 08:56:30 PST 2024
================
@@ -28,22 +28,50 @@ module @named_module_acceptable {
// -----
-// The IR remains untouched because of the presence of a branch op `cf.cond_br`.
+// The IR contains both conditional and unconditional branches with a loop
+// in which the last cf.cond_br is referncing the first cf.br
//
-func.func @dont_touch_unacceptable_ir_has_cleanable_simple_op_with_branch_op(%arg0: i1) {
+func.func @acceptable_ir_has_cleanable_loop_of_conditional_and_branch_op(%arg0: i1) {
%non_live = arith.constant 0 : i32
- // expected-error @+1 {{cannot optimize an IR with branch ops}}
- cf.cond_br %arg0, ^bb1(%non_live : i32), ^bb2(%non_live : i32)
-^bb1(%non_live_0 : i32):
- cf.br ^bb3
-^bb2(%non_live_1 : i32):
- cf.br ^bb3
-^bb3:
+ // CHECK-NOT: arith.constant
+ cf.br ^bb1(%non_live : i32)
----------------
codemzs wrote:
lets add a check for `cf.br` i.e what is expected after this line.
https://github.com/llvm/llvm-project/pull/117501
More information about the Mlir-commits
mailing list