summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/IPO/GlobalOpt.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2011-01-01 22:31:46 +0000
committerChris Lattner <sabre@nondot.org>2011-01-01 22:31:46 +0000
commit1903c42b97263ad24c796f68be639f1513fdbcf7 (patch)
tree049f956ad0e114b4f0d25ab5f8cd1d54ebe51f97 /llvm/lib/Transforms/IPO/GlobalOpt.cpp
parentabe3eaa481a8cd930ecd9c57740994501ef45e78 (diff)
downloadbcm5719-llvm-1903c42b97263ad24c796f68be639f1513fdbcf7.tar.gz
bcm5719-llvm-1903c42b97263ad24c796f68be639f1513fdbcf7.zip
fix a globalopt crash on two Adobe-C++ testcases that the recent
loop idiom pass exposed. llvm-svn: 122674
Diffstat (limited to 'llvm/lib/Transforms/IPO/GlobalOpt.cpp')
-rw-r--r--llvm/lib/Transforms/IPO/GlobalOpt.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/IPO/GlobalOpt.cpp b/llvm/lib/Transforms/IPO/GlobalOpt.cpp
index f8064352fb1..c55ee563baf 100644
--- a/llvm/lib/Transforms/IPO/GlobalOpt.cpp
+++ b/llvm/lib/Transforms/IPO/GlobalOpt.cpp
@@ -167,6 +167,11 @@ static bool AnalyzeGlobal(const Value *V, GlobalStatus &GS,
const User *U = *UI;
if (const ConstantExpr *CE = dyn_cast<ConstantExpr>(U)) {
GS.HasNonInstructionUser = true;
+
+ // If the result of the constantexpr isn't pointer type, then we won't
+ // know to expect it in various places. Just reject early.
+ if (!isa<PointerType>(CE->getType())) return true;
+
if (AnalyzeGlobal(CE, GS, PHIUsers)) return true;
} else if (const Instruction *I = dyn_cast<Instruction>(U)) {
if (!GS.HasMultipleAccessingFunctions) {
OpenPOWER on IntegriCloud