diff options
| author | Devang Patel <dpatel@apple.com> | 2007-09-18 01:54:42 +0000 |
|---|---|---|
| committer | Devang Patel <dpatel@apple.com> | 2007-09-18 01:54:42 +0000 |
| commit | fcda998ab2f44aa1f8015b3e8084de3a442d7a9e (patch) | |
| tree | bffe59ecb987e21480bd1326ba47239390ba0970 /llvm/lib | |
| parent | 067f1d8e95b554cfb0b9ab0035953a2cbac3d82f (diff) | |
| download | bcm5719-llvm-fcda998ab2f44aa1f8015b3e8084de3a442d7a9e.tar.gz bcm5719-llvm-fcda998ab2f44aa1f8015b3e8084de3a442d7a9e.zip | |
Fix PR1657
llvm-svn: 42075
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/LICM.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/LICM.cpp b/llvm/lib/Transforms/Scalar/LICM.cpp index ac927da07e3..6c5976ad3a9 100644 --- a/llvm/lib/Transforms/Scalar/LICM.cpp +++ b/llvm/lib/Transforms/Scalar/LICM.cpp @@ -791,6 +791,14 @@ void LICM::FindPromotableValuesInLoop( break; } + // If GEP base is NULL then the calculated address used by Store or + // Load instruction is invalid. Do not promote this value because + // it may expose load and store instruction that are covered by + // condition which may not yet folded. + if (GetElementPtrInst *GEP = dyn_cast<GetElementPtrInst>(V)) + if (isa<ConstantPointerNull>(GEP->getOperand(0))) + PointerOk = false; + if (PointerOk) { const Type *Ty = cast<PointerType>(V->getType())->getElementType(); AllocaInst *AI = new AllocaInst(Ty, 0, V->getName()+".tmp", FnStart); |

