Add a test for hoisting instructions with metadata out of then/else blocks
authorBjorn Steinbrink <bsteinbr@gmail.com>
Tue, 9 Sep 2014 17:10:21 +0000 (17:10 +0000)
committerBjorn Steinbrink <bsteinbr@gmail.com>
Tue, 9 Sep 2014 17:10:21 +0000 (17:10 +0000)
Test for the bug fixed in r215723.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217453 91177308-0d34-0410-b5e6-96231b3b80d8

test/Transforms/SimplifyCFG/hoist-with-range.ll [new file with mode: 0644]

diff --git a/test/Transforms/SimplifyCFG/hoist-with-range.ll b/test/Transforms/SimplifyCFG/hoist-with-range.ll
new file mode 100644 (file)
index 0000000..362aa9a
--- /dev/null
@@ -0,0 +1,20 @@
+; RUN: opt < %s -simplifycfg -S | FileCheck %s
+
+define void @foo(i1 %c, i8* %p) {
+; CHECK: if:
+; CHECK-NEXT: load i8* %p, !range !0
+; CHECK: !0 = metadata !{i8 0, i8 1, i8 3, i8 5}
+if:
+  br i1 %c, label %then, label %else
+then:
+  %t = load i8* %p, !range !0
+  br label %out
+else:
+  %e = load i8* %p, !range !1
+  br label %out
+out:
+  ret void
+}
+
+!0 = metadata !{ i8 0, i8 1 }
+!1 = metadata !{ i8 3, i8 5 }