[PATCH] D48283: [SCEV] Properly solve quadratic equations

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 19 13:32:13 PDT 2018


efriedma added a comment.

Another crash:

  define signext i32 @func() {
  entry:
    br label %loop
  
  loop:
    %ivr = phi i32 [ 0, %entry ], [ %ivr1, %loop ]
    %inc = phi i32 [ -100000, %entry ], [ %inc1, %loop ]
    %acc = phi i32 [ 100000, %entry ], [ %acc1, %loop ]
    %ivr1 = add i32 %ivr, %inc
    %inc1 = add i32 %inc, 1                 ; M = inc1 = inc + N = X + N
    %acc1 = add i32 %acc, %inc              ; L = acc1 = X + Y
    %and  = and i32 %acc1, -1            ; iW
    %cond = icmp sgt i32 %and, 5
    br i1 %cond, label %exit, label %loop
  
  exit:
    %rv = phi i32 [ %acc1, %loop ]
    ret i32 %rv
  }



================
Comment at: lib/Analysis/ScalarEvolution.cpp:8273
+/// (b) n >= 1 and q(n-1) and q(n) belong to two different intervals
+///     [Rk, Rk+R), where R = 2^BW, and k is an integer.
+/// (The idea here is to find when q(n) "overflows" 2^BW, while at the
----------------
Please explicitly state this is treating the coefficients L, M, and N as signed integers.


Repository:
  rL LLVM

https://reviews.llvm.org/D48283





More information about the llvm-commits mailing list