summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-09-27 22:28:11 +0000
committerChris Lattner <sabre@nondot.org>2005-09-27 22:28:11 +0000
commit9a5582f2516634f5b66c9bbdbab5360d6eb3ef35 (patch)
treede896b327e5efd378ce1e1b862f4f514a90ba56c
parentee35a4f9580edfb8683f15fb848e80ff7b438abb (diff)
downloadexternal_llvm-9a5582f2516634f5b66c9bbdbab5360d6eb3ef35.zip
external_llvm-9a5582f2516634f5b66c9bbdbab5360d6eb3ef35.tar.gz
external_llvm-9a5582f2516634f5b66c9bbdbab5360d6eb3ef35.tar.bz2
Fix a regression in my previous patch, fixing GlobalOpt/2005-09-27-Crash.ll
and PR632. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23484 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Transforms/IPO/GlobalOpt.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/Transforms/IPO/GlobalOpt.cpp b/lib/Transforms/IPO/GlobalOpt.cpp
index 3b2eee0..839d776 100644
--- a/lib/Transforms/IPO/GlobalOpt.cpp
+++ b/lib/Transforms/IPO/GlobalOpt.cpp
@@ -337,7 +337,7 @@ static bool CleanupConstantGlobalUsers(Value *V, Constant *Init) {
Constant *SubInit = 0;
ConstantExpr *CE =
dyn_cast_or_null<ConstantExpr>(ConstantFoldInstruction(GEP));
- if (CE && CE->getOpcode() == Instruction::GetElementPtr)
+ if (Init && CE && CE->getOpcode() == Instruction::GetElementPtr)
SubInit = ConstantFoldLoadThroughGEPConstantExpr(Init, CE);
Changed |= CleanupConstantGlobalUsers(GEP, SubInit);