[llvm-commits] [llvm] r119493 - in /llvm/trunk/lib: Analysis/Lint.cpp VMCore/BasicBlock.cpp
Duncan Sands
baldrick at free.fr
Wed Nov 17 02:23:23 PST 2010
Author: baldrick
Date: Wed Nov 17 04:23:23 2010
New Revision: 119493
URL: http://llvm.org/viewvc/llvm-project?rev=119493&view=rev
Log:
Now that hasConstantValue has been made simpler, it may return the
phi node itself if it occurs in an unreachable basic block. Protect
against this. Hopefully this will fix some more buildbots.
Modified:
llvm/trunk/lib/Analysis/Lint.cpp
llvm/trunk/lib/VMCore/BasicBlock.cpp
Modified: llvm/trunk/lib/Analysis/Lint.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/Lint.cpp?rev=119493&r1=119492&r2=119493&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/Lint.cpp (original)
+++ llvm/trunk/lib/Analysis/Lint.cpp Wed Nov 17 04:23:23 2010
@@ -583,7 +583,8 @@
}
} else if (PHINode *PN = dyn_cast<PHINode>(V)) {
if (Value *W = PN->hasConstantValue())
- return findValueImpl(W, OffsetOk, Visited);
+ if (W != V)
+ return findValueImpl(W, OffsetOk, Visited);
} else if (CastInst *CI = dyn_cast<CastInst>(V)) {
if (CI->isNoopCast(TD ? TD->getIntPtrType(V->getContext()) :
Type::getInt64Ty(V->getContext())))
Modified: llvm/trunk/lib/VMCore/BasicBlock.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/BasicBlock.cpp?rev=119493&r1=119492&r2=119493&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/BasicBlock.cpp (original)
+++ llvm/trunk/lib/VMCore/BasicBlock.cpp Wed Nov 17 04:23:23 2010
@@ -248,10 +248,11 @@
// If all incoming values to the Phi are the same, we can replace the Phi
// with that value.
Value* PNV = 0;
- if (!DontDeleteUselessPHIs && (PNV = PN->hasConstantValue())) {
- PN->replaceAllUsesWith(PNV);
- PN->eraseFromParent();
- }
+ if (!DontDeleteUselessPHIs && (PNV = PN->hasConstantValue()))
+ if (PNV != PN) {
+ PN->replaceAllUsesWith(PNV);
+ PN->eraseFromParent();
+ }
}
}
}
More information about the llvm-commits
mailing list