diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2004-07-18 00:18:30 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2004-07-18 00:18:30 +0000 |
commit | e840434755e2165ac20ec55e9d5ff3d2defac2d2 (patch) | |
tree | 546353c849d6137556b5dfb7e90d317a7c37b42c /lib/Analysis/ScalarEvolution.cpp | |
parent | e0125b678539029091e70695cf4219ec2c297a25 (diff) |
bug 122:
- Replace ConstantPointerRef usage with GlobalValue usage
- Minimize redundant isa<GlobalValue> usage
- Correct isa<Constant> for GlobalValue subclass
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14942 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/ScalarEvolution.cpp')
-rw-r--r-- | lib/Analysis/ScalarEvolution.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp index 257fc0d7fe..cac3b507ba 100644 --- a/lib/Analysis/ScalarEvolution.cpp +++ b/lib/Analysis/ScalarEvolution.cpp @@ -1498,9 +1498,9 @@ static Constant *ConstantFold(const Instruction *I, case Instruction::Select: return ConstantExpr::getSelect(Operands[0], Operands[1], Operands[2]); case Instruction::Call: - if (ConstantPointerRef *CPR = dyn_cast<ConstantPointerRef>(Operands[0])) { + if (Function *GV = dyn_cast<Function>(Operands[0])) { Operands.erase(Operands.begin()); - return ConstantFoldCall(cast<Function>(CPR->getValue()), Operands); + return ConstantFoldCall(cast<Function>(GV), Operands); } return 0; @@ -1560,9 +1560,9 @@ static PHINode *getConstantEvolvingPHI(Value *V, const Loop *L) { /// reason, return null. static Constant *EvaluateExpression(Value *V, Constant *PHIVal) { if (isa<PHINode>(V)) return PHIVal; - if (Constant *C = dyn_cast<Constant>(V)) return C; if (GlobalValue *GV = dyn_cast<GlobalValue>(V)) - return ConstantPointerRef::get(GV); + return GV; + if (Constant *C = dyn_cast<Constant>(V)) return C; Instruction *I = cast<Instruction>(V); std::vector<Constant*> Operands; @@ -1718,8 +1718,6 @@ SCEVHandle ScalarEvolutionsImpl::getSCEVAtScope(SCEV *V, const Loop *L) { Value *Op = I->getOperand(i); if (Constant *C = dyn_cast<Constant>(Op)) { Operands.push_back(C); - } else if (GlobalValue *GV = dyn_cast<GlobalValue>(Op)) { - Operands.push_back(ConstantPointerRef::get(GV)); } else { SCEVHandle OpV = getSCEVAtScope(getSCEV(Op), L); if (SCEVConstant *SC = dyn_cast<SCEVConstant>(OpV)) |