summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/Transforms/Utils/Local.cpp
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
commit6dcd49bc2b4dd5e6f76544571b9be2e5ffd3ddce (patch)
treed09143a1a7bf2e7d756c68bb1d780c1c5da81c04 /llvm/unittests/Transforms/Utils/Local.cpp
parent5decec97e53d3dd5caa8a6315b84bc37d6dcc85d (diff)
downloadbcm5719-llvm-6dcd49bc2b4dd5e6f76544571b9be2e5ffd3ddce.tar.gz
bcm5719-llvm-6dcd49bc2b4dd5e6f76544571b9be2e5ffd3ddce.zip
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). llvm-svn: 126124
Diffstat (limited to 'llvm/unittests/Transforms/Utils/Local.cpp')
-rw-r--r--llvm/unittests/Transforms/Utils/Local.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/unittests/Transforms/Utils/Local.cpp b/llvm/unittests/Transforms/Utils/Local.cpp
index 2de09ada27a..e0322b37d33 100644
--- a/llvm/unittests/Transforms/Utils/Local.cpp
+++ b/llvm/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;
OpenPOWER on IntegriCloud