/// 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
isa<GetElementPtrInst>(Inst))
return true;
- if (Inst->getOpcode() == Instruction::And &&
+ if (Inst->getOpcode() == Instruction::Add &&
isa<ConstantInt>(Inst->getOperand(1)))
return true;
/// 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))