[llvm-commits] CVS: llvm/lib/Transforms/Scalar/LICM.cpp
Chris Lattner
lattner at cs.uiuc.edu
Mon Nov 29 13:26:26 PST 2004
Changes in directory llvm/lib/Transforms/Scalar:
LICM.cpp updated: 1.68 -> 1.69
---
Log message:
Allow hoisting loads of globals and alloca's in conditionals.
---
Diffs of the changes: (+6 -0)
Index: llvm/lib/Transforms/Scalar/LICM.cpp
diff -u llvm/lib/Transforms/Scalar/LICM.cpp:1.68 llvm/lib/Transforms/Scalar/LICM.cpp:1.69
--- llvm/lib/Transforms/Scalar/LICM.cpp:1.68 Fri Nov 26 15:20:09 2004
+++ llvm/lib/Transforms/Scalar/LICM.cpp Mon Nov 29 15:26:12 2004
@@ -592,6 +592,12 @@
if (Inst.getParent() == CurLoop->getHeader())
return true;
+ // It's always safe to load from a global or alloca.
+ if (isa<LoadInst>(Inst))
+ if (isa<AllocationInst>(Inst.getOperand(0)) ||
+ isa<GlobalVariable>(Inst.getOperand(0)))
+ return true;
+
// Get the exit blocks for the current loop.
std::vector<BasicBlock*> ExitBlocks;
CurLoop->getExitBlocks(ExitBlocks);
More information about the llvm-commits
mailing list