diff options
| author | Chris Lattner <sabre@nondot.org> | 2009-12-08 06:06:26 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2009-12-08 06:06:26 +0000 |
| commit | 6425a23c8c953549350be1e543349dc8f6e1d87a (patch) | |
| tree | ff7cdf018efa305f5fc7a4ef8653f586d29147e0 | |
| parent | 8bca014d7fbbd9b150d0ffac5d06454a2f85a5aa (diff) | |
| download | bcm5719-llvm-6425a23c8c953549350be1e543349dc8f6e1d87a.tar.gz bcm5719-llvm-6425a23c8c953549350be1e543349dc8f6e1d87a.zip | |
fix a typo (and -> add) and fix GetAvailablePHITranslatedSubExpr to not
side-effect the current object.
llvm-svn: 90837
| -rw-r--r-- | llvm/include/llvm/Analysis/PHITransAddr.h | 2 | ||||
| -rw-r--r-- | llvm/lib/Analysis/PHITransAddr.cpp | 9 |
2 files changed, 7 insertions, 4 deletions
diff --git a/llvm/include/llvm/Analysis/PHITransAddr.h b/llvm/include/llvm/Analysis/PHITransAddr.h index 678d40561e8..1f4f3416da8 100644 --- a/llvm/include/llvm/Analysis/PHITransAddr.h +++ b/llvm/include/llvm/Analysis/PHITransAddr.h @@ -88,7 +88,7 @@ private: /// PHITranslateSubExpr if it dominates PredBB, otherwise return null. Value *GetAvailablePHITranslatedSubExpr(Value *V, BasicBlock *CurBB, BasicBlock *PredBB, - const DominatorTree &DT); + const DominatorTree &DT) const; /// InsertPHITranslatedSubExpr - Insert a computation of the PHI translated /// version of 'V' for the edge PredBB->CurBB into the end of the PredBB diff --git a/llvm/lib/Analysis/PHITransAddr.cpp b/llvm/lib/Analysis/PHITransAddr.cpp index bb95926c526..98cea9bb4bd 100644 --- a/llvm/lib/Analysis/PHITransAddr.cpp +++ b/llvm/lib/Analysis/PHITransAddr.cpp @@ -22,7 +22,7 @@ static bool CanPHITrans(Instruction *Inst) { isa<GetElementPtrInst>(Inst)) return true; - if (Inst->getOpcode() == Instruction::And && + if (Inst->getOpcode() == Instruction::Add && isa<ConstantInt>(Inst->getOperand(1))) return true; @@ -205,9 +205,12 @@ bool PHITransAddr::PHITranslateValue(BasicBlock *CurBB, BasicBlock *PredBB) { /// PHITranslateSubExpr if it dominates PredBB, otherwise return null. Value *PHITransAddr:: GetAvailablePHITranslatedSubExpr(Value *V, BasicBlock *CurBB,BasicBlock *PredBB, - const DominatorTree &DT) { + const DominatorTree &DT) const { + PHITransAddr Tmp(V, TD); + Tmp.PHITranslateValue(CurBB, PredBB); + // See if PHI translation succeeds. - V = PHITranslateSubExpr(V, CurBB, PredBB); + V = Tmp.getAddr(); // Make sure the value is live in the predecessor. if (Instruction *Inst = dyn_cast_or_null<Instruction>(V)) |

