summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/SimplifyCFG
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/test/Transforms/SimplifyCFG')
-rw-r--r--llvm/test/Transforms/SimplifyCFG/callbr-destinations.ll28
1 files changed, 28 insertions, 0 deletions
diff --git a/llvm/test/Transforms/SimplifyCFG/callbr-destinations.ll b/llvm/test/Transforms/SimplifyCFG/callbr-destinations.ll
new file mode 100644
index 00000000000..18210e5e0b0
--- /dev/null
+++ b/llvm/test/Transforms/SimplifyCFG/callbr-destinations.ll
@@ -0,0 +1,28 @@
+; RUN: opt < %s -simplifycfg -disable-output
+;
+; Test that SimplifyCFG does not cause CallBr instructions to have duplicate
+; destinations, which will cause the verifier to assert.
+
+define void @fun0() {
+entry:
+ callbr void asm sideeffect "", "X"(i8* blockaddress(@fun0, %bb1))
+ to label %bb2 [label %bb1]
+
+bb1: ; preds = %bb
+ ret void
+
+bb2: ; preds = %bb
+ ret void
+}
+
+define void @fun1() {
+entry:
+ callbr void asm sideeffect "", "X"(i8* blockaddress(@fun1, %bb1))
+ to label %bb2 [label %bb1]
+
+bb2: ; preds = %bb
+ ret void
+
+bb1: ; preds = %bb
+ ret void
+}
OpenPOWER on IntegriCloud