aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2007-07-25 23:54:42 +0000
committerOwen Anderson <resistor@mac.com>2007-07-25 23:54:42 +0000
commit3a9c0ccd2d92f8acd4f78c281de1dd61f4f89782 (patch)
treeb15e23af91f81add995912e606f8837db6b150f2 /lib
parentffee401ebf20a9c0161b8114afe1165cde00a066 (diff)
downloadexternal_llvm-3a9c0ccd2d92f8acd4f78c281de1dd61f4f89782.zip
external_llvm-3a9c0ccd2d92f8acd4f78c281de1dd61f4f89782.tar.gz
external_llvm-3a9c0ccd2d92f8acd4f78c281de1dd61f4f89782.tar.bz2
Fix what is _hopefully_ the last corner case for loops.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40503 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Transforms/Scalar/GVN.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/Transforms/Scalar/GVN.cpp b/lib/Transforms/Scalar/GVN.cpp
index f3aa796..d7e6228 100644
--- a/lib/Transforms/Scalar/GVN.cpp
+++ b/lib/Transforms/Scalar/GVN.cpp
@@ -738,8 +738,12 @@ Value *GVN::performPHIConstruction(BasicBlock *BB, LoadInst* orig,
for (pred_iterator PI = pred_begin(BB), E = pred_end(BB); PI != E; ++PI)
if (!visited.count(*PI))
PN->addIncoming(performPHIConstruction(*PI, orig, Phis, visited), *PI);
- else
- PN->addIncoming(Phis[*PI], *PI);
+ else {
+ if (Phis[*PI])
+ PN->addIncoming(Phis[*PI], *PI);
+ else
+ PN->addIncoming(PN, *PI);
+ }
visited.erase(BB);
bool all_same = PN->getNumIncomingValues() != 1;