diff options
| author | Devang Patel <dpatel@apple.com> | 2007-09-25 17:55:50 +0000 |
|---|---|---|
| committer | Devang Patel <dpatel@apple.com> | 2007-09-25 17:55:50 +0000 |
| commit | 440d13b55b42e9464e5ab5b59346207a50ed5a1a (patch) | |
| tree | c253b8d8e6298e46f7c4b265a0ba9ec4f4340c53 /llvm/lib/Transforms | |
| parent | 2af52eb4544b41557472e922fc0934f462b4a474 (diff) | |
| download | bcm5719-llvm-440d13b55b42e9464e5ab5b59346207a50ed5a1a.tar.gz bcm5719-llvm-440d13b55b42e9464e5ab5b59346207a50ed5a1a.zip | |
Do not reserve DOM check for GetElementPtrInst.
llvm-svn: 42306
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/LICM.cpp | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/llvm/lib/Transforms/Scalar/LICM.cpp b/llvm/lib/Transforms/Scalar/LICM.cpp index f112ba82620..e461c887ea2 100644 --- a/llvm/lib/Transforms/Scalar/LICM.cpp +++ b/llvm/lib/Transforms/Scalar/LICM.cpp @@ -811,30 +811,31 @@ void LICM::FindPromotableValuesInLoop( // 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); |

