[PATCH] D34672: [IRCE][NFC] Better get SCEV for 1 in calculateSubRanges

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 27 21:57:58 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL306503: [IRCE][NFC] Better get SCEV for 1 in calculateSubRanges (authored by mkazantsev).

Changed prior to commit:
  https://reviews.llvm.org/D34672?vs=104107&id=104347#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D34672

Files:
  llvm/trunk/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp


Index: llvm/trunk/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp
===================================================================
--- llvm/trunk/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp
+++ llvm/trunk/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp
@@ -917,7 +917,6 @@
   // I think we can be more aggressive here and make this nuw / nsw if the
   // addition that feeds into the icmp for the latch's terminating branch is nuw
   // / nsw.  In any case, a wrapping 2's complement addition is safe.
-  ConstantInt *One = ConstantInt::get(Ty, 1);
   const SCEV *Start = SE.getSCEV(MainLoopStructure.IndVarStart);
   const SCEV *End = SE.getSCEV(MainLoopStructure.LoopExitAt);
 
@@ -948,8 +947,9 @@
     //    will be an empty range.  Returning an empty range is always safe.
     //
 
-    Smallest = SE.getAddExpr(End, SE.getSCEV(One));
-    Greatest = SE.getAddExpr(Start, SE.getSCEV(One));
+    const SCEV *One = SE.getOne(Ty);
+    Smallest = SE.getAddExpr(End, One);
+    Greatest = SE.getAddExpr(Start, One);
   }
 
   auto Clamp = [this, Smallest, Greatest](const SCEV *S) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34672.104347.patch
Type: text/x-patch
Size: 1118 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170628/110ad5dd/attachment.bin>


More information about the llvm-commits mailing list