[PATCH] D34598: ScalarEvolution: Add URem support

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 28 11:01:51 PDT 2017


efriedma 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);
----------------
alexandre.isoard wrote:
> 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.
Yes, getURemExpr would be nice.


================
Comment at: test/Analysis/ScalarEvolution/flattened.ll:1
+; RUN: opt < %s -scalar-evolution -analyze | tee /dev/fd/2 | FileCheck %s
+
----------------
"tee /dev/fd/2" is not portable.

Not sure why you need it, anyway; -analyze output goes to stdout.


================
Comment at: test/Analysis/ScalarEvolution/flattened.ll:14
+; CHECK: %a.ptr
+; CHECK: -->  {%a,+,1}<nw><%bb>
+	%val = load i8, i8* %a.ptr
----------------
CHECK-NEXT


https://reviews.llvm.org/D34598





More information about the llvm-commits mailing list