[llvm] 410d03a - [NFC][SimplifyCFG] Add test for sinking common code with multuple cond predecessors
Roman Lebedev via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 28 15:01:24 PDT 2021
Author: Roman Lebedev
Date: 2021-04-29T01:01:00+03:00
New Revision: 410d03aabf725abcd6e3c5d11f4c2f4c9604627b
URL: https://github.com/llvm/llvm-project/commit/410d03aabf725abcd6e3c5d11f4c2f4c9604627b
DIFF: https://github.com/llvm/llvm-project/commit/410d03aabf725abcd6e3c5d11f4c2f4c9604627b.diff
LOG: [NFC][SimplifyCFG] Add test for sinking common code with multuple cond predecessors
Added:
Modified:
llvm/test/Transforms/SimplifyCFG/X86/sink-common-code.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/SimplifyCFG/X86/sink-common-code.ll b/llvm/test/Transforms/SimplifyCFG/X86/sink-common-code.ll
index f7b1b7f7c4e2..ade36c7019d1 100644
--- a/llvm/test/Transforms/SimplifyCFG/X86/sink-common-code.ll
+++ b/llvm/test/Transforms/SimplifyCFG/X86/sink-common-code.ll
@@ -1484,6 +1484,7 @@ if.end.icp:
}
declare void @direct_callee()
declare void @direct_callee2()
+declare void @direct_callee3()
declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture)
declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture)
@@ -1530,3 +1531,45 @@ end:
ret void
}
declare void @use32(i32)
+
+define void @multiple_cond_preds(i1 %c0, i1 %c1, i1 %c2) {
+; CHECK-LABEL: @multiple_cond_preds(
+; CHECK-NEXT: dispatch0:
+; CHECK-NEXT: br i1 [[C0:%.*]], label [[DISPATCH1:%.*]], label [[DISPATCH2:%.*]]
+; CHECK: dispatch1:
+; CHECK-NEXT: call void @direct_callee2()
+; CHECK-NEXT: br i1 [[C1:%.*]], label [[UNCOND_PRED0:%.*]], label [[END:%.*]]
+; CHECK: dispatch2:
+; CHECK-NEXT: call void @direct_callee3()
+; CHECK-NEXT: br i1 [[C2:%.*]], label [[UNCOND_PRED1:%.*]], label [[END]]
+; CHECK: uncond_pred0:
+; CHECK-NEXT: call void @direct_callee()
+; CHECK-NEXT: br label [[END]]
+; CHECK: uncond_pred1:
+; CHECK-NEXT: call void @direct_callee()
+; CHECK-NEXT: br label [[END]]
+; CHECK: end:
+; CHECK-NEXT: ret void
+;
+dispatch0:
+ br i1 %c0, label %dispatch1, label %dispatch2
+
+dispatch1:
+ call void @direct_callee2()
+ br i1 %c1, label %uncond_pred0, label %end
+
+dispatch2:
+ call void @direct_callee3()
+ br i1 %c2, label %uncond_pred1, label %end
+
+uncond_pred0:
+ call void @direct_callee()
+ br label %end
+
+uncond_pred1:
+ call void @direct_callee()
+ br label %end
+
+end:
+ ret void
+}
More information about the llvm-commits
mailing list