summaryrefslogtreecommitdiff
path: root/test/Transforms/SimplifyCFG
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-10-29 17:46:26 +0000
committerChris Lattner <sabre@nondot.org>2008-10-29 17:46:26 +0000
commitf8131c99de2ac66be4307ae24f2db44d12bc9b3f (patch)
tree4c917a1c21ef677a38c3d0e6b4859ecfea543c1f /test/Transforms/SimplifyCFG
parent90e619afbef9886c65650d0464e3cc87deb8c298 (diff)
downloadllvm-f8131c99de2ac66be4307ae24f2db44d12bc9b3f.tar.gz
llvm-f8131c99de2ac66be4307ae24f2db44d12bc9b3f.tar.bz2
llvm-f8131c99de2ac66be4307ae24f2db44d12bc9b3f.tar.xz
Fix PR2967 by not deleting volatile load/stores that occur before unreachable.
I don't really see this as being needed, but there is little harm from doing it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58385 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/SimplifyCFG')
-rw-r--r--test/Transforms/SimplifyCFG/trapping-load-unreachable.ll19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/Transforms/SimplifyCFG/trapping-load-unreachable.ll b/test/Transforms/SimplifyCFG/trapping-load-unreachable.ll
new file mode 100644
index 0000000000..a73a82b369
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/trapping-load-unreachable.ll
@@ -0,0 +1,19 @@
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | grep {volatile load}
+; PR2967
+
+target datalayout =
+"e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32"
+target triple = "i386-pc-linux-gnu"
+
+define void @foo(i32 %x) nounwind {
+entry:
+ %0 = icmp eq i32 %x, 0 ; <i1> [#uses=1]
+ br i1 %0, label %bb, label %return
+
+bb: ; preds = %entry
+ %1 = volatile load i32* null ; <i32> [#uses=0]
+ unreachable
+ br label %return
+return: ; preds = %entry
+ ret void
+}