Do not promote null values because it may be unsafe to do so.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42270 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Devang Patel
2007-09-24 20:02:42 +00:00
parent d81ccc2806
commit 128459b85b
2 changed files with 50 additions and 0 deletions

View File

@@ -800,6 +800,10 @@ void LICM::FindPromotableValuesInLoop(
break;
}
// Do not promote null values because it may be unsafe to do so.
if (isa<ConstantPointerNull>(V))
PointerOk = false;
if (GetElementPtrInst *GEP = dyn_cast<GetElementPtrInst>(V)) {
// If GEP base is NULL then the calculated address used by Store or
// Load instruction is invalid. Do not promote this value because