[PATCH] D44564: [BasicAA] Relax restriction on PHI node handling.

John Brawn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 20 11:15:52 PDT 2018


john.brawn added inline comments.


================
Comment at: lib/Analysis/BasicAliasAnalysis.cpp:1566
   AliasResult Alias =
       aliasCheck(V2, V2Size, V2AAInfo, V1Srcs[0],
                  PNSize, PNAAInfo, UnderV2);
----------------
mkazantsev wrote:
> How do we know that V1Srcs is not empty at this point?
For that to happen we would have to have a phi with no underlying non-phi values, which I'm pretty sure can only happen in unreachable blocks, e.g. something like
  define void @fn(i32* %p) {
  entry:
    br label %exit

  exit:
    ret void

  unreachable:
    %phi = phi i32* [ %phi, %unreachable ]
    %load1 = load i32, i32* %p, align 4
    %load2 = load i32, i32* %phi, align 4
    %cmp = icmp ne i32 %load1, %load2
    br i1 %cmp, label %exit, label %unreachable
  }
Which we shouldn't ever normally see, but it is possible to manually craft such IR (e.g. the above) and it currently causes a crash so I'll adjust it to fix that.


Repository:
  rL LLVM

https://reviews.llvm.org/D44564





More information about the llvm-commits mailing list