From: Dan Gohman Date: Fri, 8 May 2009 20:58:38 +0000 (+0000) Subject: Fix another bug in r71252. This code supports GetElementPtr X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=fb791608115b5193419549b02825ed4337fd3a37;p=oota-llvm.git Fix another bug in r71252. This code supports GetElementPtr constant exprs as well as instructions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71262 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/Analysis/ScalarEvolution.h b/include/llvm/Analysis/ScalarEvolution.h index c9a80b74a2d..37b1dc0ddd8 100644 --- a/include/llvm/Analysis/ScalarEvolution.h +++ b/include/llvm/Analysis/ScalarEvolution.h @@ -286,7 +286,7 @@ namespace llvm { /// createNodeForGEP - Provide the special handling we need to analyze GEP /// SCEVs. - SCEVHandle createNodeForGEP(GetElementPtrInst *GEP); + SCEVHandle createNodeForGEP(User *GEP); /// ReplaceSymbolicValueWithConcrete - This looks up the computed SCEV value /// for the specified instruction and replaces any references to the diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp index 4ddde5db5ed..90c4f5758fe 100644 --- a/lib/Analysis/ScalarEvolution.cpp +++ b/lib/Analysis/ScalarEvolution.cpp @@ -1866,7 +1866,7 @@ SCEVHandle ScalarEvolution::createNodeForPHI(PHINode *PN) { /// createNodeForGEP - Expand GEP instructions into add and multiply /// operations. This allows them to be analyzed by regular SCEV code. /// -SCEVHandle ScalarEvolution::createNodeForGEP(GetElementPtrInst *GEP) { +SCEVHandle ScalarEvolution::createNodeForGEP(User *GEP) { const Type *IntPtrTy = TD->getIntPtrType(); Value *Base = GEP->getOperand(0); @@ -2113,7 +2113,7 @@ SCEVHandle ScalarEvolution::createSCEV(Value *V) { case Instruction::GetElementPtr: if (!TD) break; // Without TD we can't analyze pointers. - return createNodeForGEP(cast(U)); + return createNodeForGEP(U); case Instruction::PHI: return createNodeForPHI(cast(U));