File tree Expand file tree Collapse file tree 2 files changed +28
-2
lines changed
lib/Conversion/ControlFlowToSCF
test/Conversion/ControlFlowToSCF Expand file tree Collapse file tree 2 files changed +28
-2
lines changed Original file line number Diff line number Diff line change @@ -164,8 +164,8 @@ struct LiftControlFlowToSCF
164164
165165 bool changed = false ;
166166 Operation *op = getOperation ();
167- WalkResult result = op->walk ([&](func::FuncOp funcOp) {
168- if (funcOp.getBody ().empty ())
167+ WalkResult result = op->walk ([&](FunctionOpInterface funcOp) {
168+ if (funcOp.getFunctionBody ().empty ())
169169 return WalkResult::advance ();
170170
171171 auto &domInfo = funcOp != op ? getChildAnalysis<DominanceInfo>(funcOp)
Original file line number Diff line number Diff line change @@ -756,3 +756,29 @@ func.func @nested_region_outside_loop_use() {
756756
757757// CHECK: scf.execute_region
758758// CHECK-NEXT: "test.foo"(%[[RES]])
759+
760+ // -----
761+
762+ llvm.func @llvm_func () {
763+ %cond = " test.test1" () : () -> i1
764+ cf.cond_br %cond , ^bb1 , ^bb2
765+ ^bb1 :
766+ " test.test2" () : () -> ()
767+ cf.br ^bb3
768+ ^bb2 :
769+ " test.test3" () : () -> ()
770+ cf.br ^bb3
771+ ^bb3 :
772+ " test.test4" () : () -> ()
773+ return
774+ }
775+
776+ // CHECK-LABEL: llvm.func @llvm_func
777+ // CHECK: %[[COND:.*]] = "test.test1"()
778+ // CHECK-NEXT: scf.if %[[COND]]
779+ // CHECK-NEXT: "test.test2"()
780+ // CHECK-NEXT: else
781+ // CHECK-NEXT: "test.test3"()
782+ // CHECK-NEXT: }
783+ // CHECK-NEXT: "test.test4"()
784+ // CHECK-NEXT: return
You can’t perform that action at this time.
0 commit comments