From 260ad4dd63ee9e4d33709867139cc2e7d6b0d66e Mon Sep 17 00:00:00 2001 From: Sanjoy Das Date: Tue, 29 Mar 2016 16:40:39 +0000 Subject: [PATCH] [SCEV] Use Operator::getOpcode instead of manual dispatch; NFC llvm-svn: 264746 --- llvm/lib/Analysis/ScalarEvolution.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp index f76b797b4534..63985f2293bf 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(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(V)) - Opcode = CE->getOpcode(); - else if (ConstantInt *CI = dyn_cast(V)) + } else if (ConstantInt *CI = dyn_cast(V)) return getConstant(CI); else if (isa(V)) return getZero(V->getType()); else if (GlobalAlias *GA = dyn_cast(V)) return GA->mayBeOverridden() ? getUnknown(V) : getSCEV(GA->getAliasee()); - else + else if (!isa(V)) return getUnknown(V); Operator *U = cast(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