summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis
diff options
context:
space:
mode:
authorSanjoy Das <sanjoy@playingwithpointers.com>2016-03-29 16:40:39 +0000
committerSanjoy Das <sanjoy@playingwithpointers.com>2016-03-29 16:40:39 +0000
commit260ad4dd63ee9e4d33709867139cc2e7d6b0d66e (patch)
treee68162799978d540e529c69680766782e6c27e97 /llvm/lib/Analysis
parent4c1ef97adb1ecdc4ed3ee4a9ee7d5546aecda014 (diff)
downloadbcm5719-llvm-260ad4dd63ee9e4d33709867139cc2e7d6b0d66e.tar.gz
bcm5719-llvm-260ad4dd63ee9e4d33709867139cc2e7d6b0d66e.zip
[SCEV] Use Operator::getOpcode instead of manual dispatch; NFC
llvm-svn: 264746
Diffstat (limited to 'llvm/lib/Analysis')
-rw-r--r--llvm/lib/Analysis/ScalarEvolution.cpp11
1 files changed, 3 insertions, 8 deletions
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp
index f76b797b453..63985f2293b 100644
--- a/llvm/lib/Analysis/ScalarEvolution.cpp
+++ b/llvm/lib/Analysis/ScalarEvolution.cpp
@@ -4730,29 +4730,24 @@ const SCEV *ScalarEvolution::createSCEV(Value *V) {
if (!isSCEVable(V->getType()))
return getUnknown(V);
- unsigned Opcode = Instruction::UserOp1;
if (Instruction *I = dyn_cast<Instruction>(V)) {
- Opcode = I->getOpcode();
-
// Don't attempt to analyze instructions in blocks that aren't
// reachable. Such instructions don't matter, and they aren't required
// to obey basic rules for definitions dominating uses which this
// analysis depends on.
if (!DT.isReachableFromEntry(I->getParent()))
return getUnknown(V);
- } else if (ConstantExpr *CE = dyn_cast<ConstantExpr>(V))
- Opcode = CE->getOpcode();
- else if (ConstantInt *CI = dyn_cast<ConstantInt>(V))
+ } else if (ConstantInt *CI = dyn_cast<ConstantInt>(V))
return getConstant(CI);
else if (isa<ConstantPointerNull>(V))
return getZero(V->getType());
else if (GlobalAlias *GA = dyn_cast<GlobalAlias>(V))
return GA->mayBeOverridden() ? getUnknown(V) : getSCEV(GA->getAliasee());
- else
+ else if (!isa<ConstantExpr>(V))
return getUnknown(V);
Operator *U = cast<Operator>(V);
- switch (Opcode) {
+ switch (U->getOpcode()) {
case Instruction::Add: {
// The simple thing to do would be to just call getSCEV on both operands
// and call getAddExpr with the result. However if we're looking at a
OpenPOWER on IntegriCloud