[llvm-commits] [llvm] r42306 - /llvm/trunk/lib/Transforms/Scalar/LICM.cpp
Devang Patel
dpatel at apple.com
Tue Sep 25 10:55:50 PDT 2007
Author: dpatel
Date: Tue Sep 25 12:55:50 2007
New Revision: 42306
URL: http://llvm.org/viewvc/llvm-project?rev=42306&view=rev
Log:
Do not reserve DOM check for GetElementPtrInst.
Modified:
llvm/trunk/lib/Transforms/Scalar/LICM.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/LICM.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LICM.cpp?rev=42306&r1=42305&r2=42306&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LICM.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LICM.cpp Tue Sep 25 12:55:50 2007
@@ -811,30 +811,31 @@
// condition which may not yet folded.
if (isa<ConstantPointerNull>(GEP->getOperand(0)))
PointerOk = false;
+ }
- // If GEP is use is not dominating loop exit then promoting
- // GEP may expose unsafe load and store instructions unconditinally.
- if (PointerOk)
- for(Value::use_iterator UI = V->use_begin(), UE = V->use_end();
- UI != UE && PointerOk; ++UI) {
- Instruction *Use = dyn_cast<Instruction>(*UI);
- if (!Use)
- continue;
- for (SmallVector<Instruction *, 4>::iterator
- ExitI = LoopExits.begin(), ExitE = LoopExits.end();
- ExitI != ExitE; ++ExitI) {
- Instruction *Ex = *ExitI;
- if (!DT->dominates(Use, Ex)){
- PointerOk = false;
- break;
- }
- }
-
- if (!PointerOk)
+ // If value V use is not dominating loop exit then promoting
+ // it may expose unsafe load and store instructions unconditinally.
+ if (PointerOk)
+ for(Value::use_iterator UI = V->use_begin(), UE = V->use_end();
+ UI != UE && PointerOk; ++UI) {
+ Instruction *Use = dyn_cast<Instruction>(*UI);
+ if (!Use || !CurLoop->contains(Use->getParent()))
+ continue;
+ for (SmallVector<Instruction *, 4>::iterator
+ ExitI = LoopExits.begin(), ExitE = LoopExits.end();
+ ExitI != ExitE; ++ExitI) {
+ Instruction *Ex = *ExitI;
+ if (!DT->dominates(Use, Ex)){
+ PointerOk = false;
break;
+ }
}
- }
-
+
+ if (!PointerOk)
+ break;
+ }
+
+
if (PointerOk) {
const Type *Ty = cast<PointerType>(V->getType())->getElementType();
AllocaInst *AI = new AllocaInst(Ty, 0, V->getName()+".tmp", FnStart);
More information about the llvm-commits
mailing list