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

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 18 11:54:43 PDT 2018


efriedma added a comment.

Following hits an assertion failure with "opt -analyze -scalar-evolution" with the latest patch, I think due to the inconsistent handling of signed-ness.

  define signext i32 @func() {
  entry:
    br label %loop
  
  loop:
    %ivr = phi i32 [ 0, %entry ], [ %ivr1, %loop ]
    %inc = phi i32 [ 0, %entry ], [ %inc1, %loop ]
    %acc = phi i32 [ -1, %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 ule i32 %and, -3
    br i1 %cond, label %exit, label %loop
  
  exit:
    %rv = phi i32 [ %acc1, %loop ]
    ret i32 %rv
  }


Repository:
  rL LLVM

https://reviews.llvm.org/D48283





More information about the llvm-commits mailing list