[PATCH] D13151: Expand loop reroll to handle loop with multiple induction variables and negative increment -part 2/3

Lawrence Hu via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 26 14:12:18 PDT 2015


hulx2000 marked 5 inline comments as done and an inline comment as not done.

================
Comment at: lib/Transforms/Scalar/LoopRerollPass.cpp:477
@@ +476,3 @@
+getPointerIncSCEV(ScalarEvolution *SE, const SCEV *SCEVExpr, Instruction *IV) {
+  const SCEVConstant *CIncSCEV = nullptr;
+  const SCEVMulExpr *MulSCEV = dyn_cast<SCEVMulExpr>(SCEVExpr);
----------------
jmolloy wrote:
> I don't think it's very useful to have this CIncSCEV variable. It'd be a lot neater (and more up to coding style) if instead of "CIncSCEV = ..; ...; return CIncSCEV;", just "return CIncSCEV;"
CIncSCEV is still needed later but I reduced the lifespan of it.

================
Comment at: lib/Transforms/Scalar/LoopRerollPass.cpp:489
@@ +488,3 @@
+      if (IncSCEV->getValue()->getValue().isNegative()) {
+        const SCEV *NewSCEV =
+            SE->getUDivExpr(SE->getNegativeSCEV(SCEVExpr), SizeOfExpr);
----------------
I didn't change this, The purpose of declaring NewSCEV here just to break the long statement into two shorter ones, and compiler will generate temp anyway even if I don't that.


Repository:
  rL LLVM

http://reviews.llvm.org/D13151





More information about the llvm-commits mailing list