[PATCH] D69442: [CVP] prevent propagating poison when substituting edge values into a phi (PR43802)

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 26 09:17:39 PDT 2019


nikic added a comment.

I initially thought that there might be a cache invalidation problem here, because we recently started to take nowrap flags into account when computing ranges, and we might end up reasoning based on the no longer present nowrap flags. In particular I had something like this in mind:

  efine i1 @test(i32 %arg) {
  entry:
    %add = add nuw i32 %arg, 1
    %cmp = icmp eq i32 %arg, -1
    br i1 %cmp, label %bb2, label %bb3
  
  bb2:
    br label %bb3
  
  bb3:
    %r = phi i32 [ 0, %bb2 ], [ %add, %entry ]
    %c = icmp eq i32 %r, 0
    ret i1 %c
  }

However, it seems like the same LVI analysis that determines the value of `%add` on the entry edge here also results in the range of `%add` in bb3 to be calculated as the full range (rather than the full range without zero), so it ends up working out in the end.

This all seems pretty fragile and there might be issues in the future if LVI gets more powerful, but I guess that for now this is fine.


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

https://reviews.llvm.org/D69442





More information about the llvm-commits mailing list