[llvm-commits] [llvm] r90837 - in /llvm/trunk: include/llvm/Analysis/PHITransAddr.h lib/Analysis/PHITransAddr.cpp
Chris Lattner
sabre at nondot.org
Mon Dec 7 22:06:26 PST 2009
Author: lattner
Date: Tue Dec 8 00:06:26 2009
New Revision: 90837
URL: http://llvm.org/viewvc/llvm-project?rev=90837&view=rev
Log:
fix a typo (and -> add) and fix GetAvailablePHITranslatedSubExpr to not
side-effect the current object.
Modified:
llvm/trunk/include/llvm/Analysis/PHITransAddr.h
llvm/trunk/lib/Analysis/PHITransAddr.cpp
Modified: llvm/trunk/include/llvm/Analysis/PHITransAddr.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/PHITransAddr.h?rev=90837&r1=90836&r2=90837&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/PHITransAddr.h (original)
+++ llvm/trunk/include/llvm/Analysis/PHITransAddr.h Tue Dec 8 00:06:26 2009
@@ -88,7 +88,7 @@
/// 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
Modified: llvm/trunk/lib/Analysis/PHITransAddr.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/PHITransAddr.cpp?rev=90837&r1=90836&r2=90837&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/PHITransAddr.cpp (original)
+++ llvm/trunk/lib/Analysis/PHITransAddr.cpp Tue Dec 8 00:06:26 2009
@@ -22,7 +22,7 @@
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 @@
/// 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))
More information about the llvm-commits
mailing list