[PATCH] D34598: ScalarEvolution: Add URem support

Alexandre Isoard via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 28 07:55:32 PDT 2017


alexandre.isoard added inline comments.


================
Comment at: lib/Analysis/ScalarEvolution.cpp:5421
       return getUDivExpr(getSCEV(BO->LHS), getSCEV(BO->RHS));
+    case Instruction::URem: {
+      const SCEV *LSCEV = getSCEV(BO->LHS);
----------------
mkazantsev wrote:
> Can we handle RHS = 1 separately and return constant 0 in this case?
That is doable, although I am not sure about the saved time as:
  - getUDivExpr detect division by 1
  - getMulExpr detect the multiplication by 1
  - getMinusSCEV detect the subtraction of equal SCEV

But it might be useful to separate the code into a getURemExpr.


https://reviews.llvm.org/D34598





More information about the llvm-commits mailing list