summaryrefslogtreecommitdiff
path: root/unittests/Transforms
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2011-02-21 16:27:36 +0000
committerDuncan Sands <baldrick@free.fr>2011-02-21 16:27:36 +0000
commitb4098ba03d51a3845bde5aeb4fca893d1a90d3f8 (patch)
tree2f4aa914786c6ab1b77095cd51700726d0b6aa73 /unittests/Transforms
parentd64cfe1506daf95483549e7347098fbf1a978097 (diff)
downloadllvm-b4098ba03d51a3845bde5aeb4fca893d1a90d3f8.tar.gz
llvm-b4098ba03d51a3845bde5aeb4fca893d1a90d3f8.tar.bz2
llvm-b4098ba03d51a3845bde5aeb4fca893d1a90d3f8.tar.xz
Simplify RecursivelyDeleteDeadPHINode. The only functionality change
should be that if the phi is used by a side-effect free instruction with no uses then the phi and the instruction now get zapped (checked by the unittest). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126124 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/Transforms')
-rw-r--r--unittests/Transforms/Utils/Local.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/unittests/Transforms/Utils/Local.cpp b/unittests/Transforms/Utils/Local.cpp
index 2de09ada27..e0322b37d3 100644
--- a/unittests/Transforms/Utils/Local.cpp
+++ b/unittests/Transforms/Utils/Local.cpp
@@ -47,6 +47,12 @@ TEST(Local, RecursivelyDeleteDeadPHINodes) {
EXPECT_TRUE(RecursivelyDeleteDeadPHINode(phi));
+ builder.SetInsertPoint(bb0);
+ phi = builder.CreatePHI(Type::getInt32Ty(C));
+ builder.CreateAdd(phi, phi);
+
+ EXPECT_TRUE(RecursivelyDeleteDeadPHINode(phi));
+
bb0->dropAllReferences();
bb1->dropAllReferences();
delete bb0;