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 | 04560145f4c76d1a430be393660e440b8d088228 (patch) | |
tree | fbe7a1097183dd7cdad8c83e33476ec089b076d6 /lib/Transforms | |
parent | ef9211a831a5e63fc462c7a16a1a379882723893 (diff) | |
download | external_llvm-04560145f4c76d1a430be393660e440b8d088228.zip external_llvm-04560145f4c76d1a430be393660e440b8d088228.tar.gz external_llvm-04560145f4c76d1a430be393660e440b8d088228.tar.bz2 |
Fix PR1657
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42075 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r-- | lib/Transforms/Scalar/LICM.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/Transforms/Scalar/LICM.cpp b/lib/Transforms/Scalar/LICM.cpp index ac927da..6c5976a 100644 --- a/lib/Transforms/Scalar/LICM.cpp +++ b/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); |