[llvm-commits] CVS: llvm/lib/Transforms/Scalar/LICM.cpp
Chris Lattner
lattner at cs.uiuc.edu
Fri Nov 26 13:20:24 PST 2004
Changes in directory llvm/lib/Transforms/Scalar:
LICM.cpp updated: 1.67 -> 1.68
---
Log message:
Provide size information when checking to see if we can LICM a load, this
allows us to hoist more loads in some cases.
---
Diffs of the changes: (+6 -3)
Index: llvm/lib/Transforms/Scalar/LICM.cpp
diff -u llvm/lib/Transforms/Scalar/LICM.cpp:1.67 llvm/lib/Transforms/Scalar/LICM.cpp:1.68
--- llvm/lib/Transforms/Scalar/LICM.cpp:1.67 Tue Sep 14 21:34:40 2004
+++ llvm/lib/Transforms/Scalar/LICM.cpp Fri Nov 26 15:20:09 2004
@@ -170,9 +170,9 @@
/// pointerInvalidatedByLoop - Return true if the body of this loop may
/// store into the memory location pointed to by V.
///
- bool pointerInvalidatedByLoop(Value *V) {
+ bool pointerInvalidatedByLoop(Value *V, unsigned Size) {
// Check to see if any of the basic blocks in CurLoop invalidate *V.
- return CurAST->getAliasSetForPointer(V, 0).isMod();
+ return CurAST->getAliasSetForPointer(V, Size).isMod();
}
bool canSinkOrHoistInst(Instruction &I);
@@ -351,7 +351,10 @@
return false; // Don't hoist volatile loads!
// Don't hoist loads which have may-aliased stores in loop.
- return !pointerInvalidatedByLoop(LI->getOperand(0));
+ unsigned Size = 0;
+ if (LI->getType()->isSized())
+ Size = AA->getTargetData().getTypeSize(LI->getType());
+ return !pointerInvalidatedByLoop(LI->getOperand(0), Size);
} else if (CallInst *CI = dyn_cast<CallInst>(&I)) {
// Handle obvious cases efficiently.
if (Function *Callee = CI->getCalledFunction()) {
More information about the llvm-commits
mailing list