From 1903c42b97263ad24c796f68be639f1513fdbcf7 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sat, 1 Jan 2011 22:31:46 +0000 Subject: fix a globalopt crash on two Adobe-C++ testcases that the recent loop idiom pass exposed. llvm-svn: 122674 --- llvm/lib/Transforms/IPO/GlobalOpt.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'llvm/lib') 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(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(CE->getType())) return true; + if (AnalyzeGlobal(CE, GS, PHIUsers)) return true; } else if (const Instruction *I = dyn_cast(U)) { if (!GS.HasMultipleAccessingFunctions) { -- cgit v1.2.3