summaryrefslogtreecommitdiff
path: root/test/Transforms/SROA
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2012-10-02 22:46:45 +0000
committerChandler Carruth <chandlerc@gmail.com>2012-10-02 22:46:45 +0000
commit5c5b3cf5b8af06b8e9347f3f45e8c67438ffd446 (patch)
tree8d0f5ecadba9f4350cceb812320fd71d8ddb0971 /test/Transforms/SROA
parent5d37976090df34f003e5128e39593b763be0ca71 (diff)
downloadllvm-5c5b3cf5b8af06b8e9347f3f45e8c67438ffd446.tar.gz
llvm-5c5b3cf5b8af06b8e9347f3f45e8c67438ffd446.tar.bz2
llvm-5c5b3cf5b8af06b8e9347f3f45e8c67438ffd446.tar.xz
Teach the new SROA to handle cases where an alloca that has already been
scheduled for processing on the worklist eventually gets deleted while we are processing another alloca, fixing the original test case in PR13990. To facilitate this, add a remove_if helper to the SetVector abstraction. It's not easy to use the standard abstractions for this because of the specifics of SetVectors types and implementation. Finally, a nice small test case is included. Thanks to Benjamin for the fantastic reduced test case here! All I had to do was delete some empty basic blocks! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165065 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/SROA')
-rw-r--r--test/Transforms/SROA/basictest.ll29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/Transforms/SROA/basictest.ll b/test/Transforms/SROA/basictest.ll
index e58cef63ba..54a25df1fb 100644
--- a/test/Transforms/SROA/basictest.ll
+++ b/test/Transforms/SROA/basictest.ll
@@ -897,3 +897,32 @@ if.end:
%tmp2 = load i8* %gep
ret void
}
+
+define void @PR13990() {
+; Ensure we can handle cases where processing one alloca causes the other
+; alloca to become dead and get deleted. This might crash or fail under
+; Valgrind if we regress.
+; CHECK: @PR13990
+; CHECK-NOT: alloca
+; CHECK: unreachable
+; CHECK: unreachable
+
+entry:
+ %tmp1 = alloca i8*
+ %tmp2 = alloca i8*
+ br i1 undef, label %bb1, label %bb2
+
+bb1:
+ store i8* undef, i8** %tmp2
+ br i1 undef, label %bb2, label %bb3
+
+bb2:
+ %tmp50 = select i1 undef, i8** %tmp2, i8** %tmp1
+ br i1 undef, label %bb3, label %bb4
+
+bb3:
+ unreachable
+
+bb4:
+ unreachable
+}