[PATCH] D71620: [Attributor] AAValueConstantRange: Value range analysis using constant range

Johannes Doerfert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 8 11:27:20 PST 2020


jdoerfert requested changes to this revision.
jdoerfert added a comment.
This revision now requires changes to proceed.

I'll push some fixes that should address the issues people saw (I hope) but there is at least one bug that the test suite exposed.

For the code below we should not replace the `%add` with 1. Can you look into that and add the test?

  define dso_local i32 @test() {
  entry:
    %call = call i32 @rec(i32 0)
    ret i32 %call
  }
  define internal i32 @rec(i32 %depth) {
  entry:
    %call = call i32 @foo(i32 %depth)
    %tobool = icmp ne i32 %call, 0
    br i1 %tobool, label %if.then, label %if.end
  
  if.then:                                          ; preds = %entry
    br label %return
  
  if.end:                                           ; preds = %entry
    %cmp = icmp slt i32 %depth, 10
    br i1 %cmp, label %if.then1, label %if.end3
  
  if.then1:                                         ; preds = %if.end
    %add = add nsw i32 %depth, 1
    %call2 = call i32 @rec(i32 %add)
    br label %if.end3
  
  if.end3:                                          ; preds = %if.then1, %if.end
    br label %return
  
  return:                                           ; preds = %if.end3, %if.then
    %retval.0 = phi i32 [ 0, %if.then ], [ 1, %if.end3 ]
    ret i32 %retval.0
  }
  declare dso_local i32 @foo(i32)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71620/new/

https://reviews.llvm.org/D71620





More information about the llvm-commits mailing list