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 | 4c7f96c5864353be7b6750b2fbfa4214dfcf0b9b (patch) | |
tree | 952e5ac1c5f00ba52d9b9a1dc84ecd8fad2e3059 /lib | |
parent | cddbcd957eef408971460d8037ce995b97df0c05 (diff) | |
download | external_llvm-4c7f96c5864353be7b6750b2fbfa4214dfcf0b9b.zip external_llvm-4c7f96c5864353be7b6750b2fbfa4214dfcf0b9b.tar.gz external_llvm-4c7f96c5864353be7b6750b2fbfa4214dfcf0b9b.tar.bz2 |
Do not reserve DOM check for GetElementPtrInst.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42306 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Transforms/Scalar/LICM.cpp | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/lib/Transforms/Scalar/LICM.cpp b/lib/Transforms/Scalar/LICM.cpp index f112ba8..e461c88 100644 --- a/lib/Transforms/Scalar/LICM.cpp +++ b/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); |