This code can handle non-dominating instructions

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22667 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2005-08-05 00:57:45 +00:00
parent 9acbd611ec
commit 5e1b231921
2 changed files with 2 additions and 2 deletions

View File

@ -256,7 +256,7 @@ BasicBlock *LoopSimplify::SplitBlockPredecessors(BasicBlock *BB,
PN->addIncoming(InVal, NewBB);
// Can we eliminate this phi node now?
if (Value *V = PN->hasConstantValue()) {
if (Value *V = PN->hasConstantValue(true)) {
if (!isa<Instruction>(V) ||
getAnalysis<DominatorSet>().dominates(cast<Instruction>(V), PN)) {
PN->replaceAllUsesWith(V);

View File

@ -347,7 +347,7 @@ void PromoteMem2Reg::run() {
PHINode *SomePHI = 0;
for (unsigned i = 0, e = PNs.size(); i != e; ++i)
if (PNs[i]) {
if (Value *V = PNs[i]->hasConstantValue()) {
if (Value *V = PNs[i]->hasConstantValue(true)) {
if (!isa<Instruction>(V) || dominates(cast<Instruction>(V), PNs[i])) {
if (AST && isa<PointerType>(PNs[i]->getType()))
AST->deleteValue(PNs[i]);