[llvm] r334735 - [SCEV] Fix indentation and combine two if statements in getMulExpr, NFC.
Justin Lebar via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 14 10:13:22 PDT 2018
Author: jlebar
Date: Thu Jun 14 10:13:22 2018
New Revision: 334735
URL: http://llvm.org/viewvc/llvm-project?rev=334735&view=rev
Log:
[SCEV] Fix indentation and combine two if statements in getMulExpr, NFC.
Modified:
llvm/trunk/lib/Analysis/ScalarEvolution.cpp
Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=334735&r1=334734&r2=334735&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original)
+++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Thu Jun 14 10:13:22 2018
@@ -2764,22 +2764,21 @@ const SCEV *ScalarEvolution::getMulExpr(
unsigned Idx = 0;
if (const SCEVConstant *LHSC = dyn_cast<SCEVConstant>(Ops[0])) {
- // C1*(C2+V) -> C1*C2 + C1*V
if (Ops.size() == 2)
- if (const SCEVAddExpr *Add = dyn_cast<SCEVAddExpr>(Ops[1]))
- // If any of Add's ops are Adds or Muls with a constant,
- // apply this transformation as well.
- if (Add->getNumOperands() == 2)
- // TODO: There are some cases where this transformation is not
- // profitable, for example:
- // Add = (C0 + X) * Y + Z.
- // Maybe the scope of this transformation should be narrowed down.
- if (containsConstantInAddMulChain(Add))
- return getAddExpr(getMulExpr(LHSC, Add->getOperand(0),
- SCEV::FlagAnyWrap, Depth + 1),
- getMulExpr(LHSC, Add->getOperand(1),
- SCEV::FlagAnyWrap, Depth + 1),
- SCEV::FlagAnyWrap, Depth + 1);
+ // C1*(C2+V) -> C1*C2 + C1*V
+ if (const SCEVAddExpr *Add = dyn_cast<SCEVAddExpr>(Ops[1]))
+ // If any of Add's ops are Adds or Muls with a constant, apply this
+ // transformation as well.
+ //
+ // TODO: There are some cases where this transformation is not
+ // profitable; for example, Add = (C0 + X) * Y + Z. Maybe the scope of
+ // this transformation should be narrowed down.
+ if (Add->getNumOperands() == 2 && containsConstantInAddMulChain(Add))
+ return getAddExpr(getMulExpr(LHSC, Add->getOperand(0),
+ SCEV::FlagAnyWrap, Depth + 1),
+ getMulExpr(LHSC, Add->getOperand(1),
+ SCEV::FlagAnyWrap, Depth + 1),
+ SCEV::FlagAnyWrap, Depth + 1);
++Idx;
while (const SCEVConstant *RHSC = dyn_cast<SCEVConstant>(Ops[Idx])) {
More information about the llvm-commits
mailing list