[PATCH] D41006: [SafepointIRVerifier] Allow non-dereferencing uses of unrelocated or poisoned PHI nodes

Anna Thomas via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 15 19:11:56 PST 2017


anna added inline comments.


================
Comment at: lib/IR/SafepointIRVerifier.cpp:279
+///         \     |
+///      p2 = phi [p] [p1]
+///      p3 = phi [p] [p]
----------------
mkazantsev wrote:
> anna wrote:
> > This is incorrect IR. We cannot have multiple *different* incoming phi values from exactly one predecessor.
> > With correct IR, I don't think we will have such false positives. If we do have, could you please add a test with FIXME?
> I don't get why it is incorrect. For example,
> 
>   void *p = &a[10];
>   void *p1 = &p[20];
>   void *temp = p;
>   if (cond) {
>     temp = p1;
>     some_call();
>   }
>   void *p2 = temp;
> 
> Won't we have exactly this IR here?
yup, you're right. What we have is different incoming values from different incoming blocks, something like: `p2 = phi [p, def BB of p], [p1, safepoint block]`
What's incorrect is, different incoming values from the same block. For example, p and p1 from their same def block: `p2 = phi [p, def BB of p] [p1, def BB of p1]`. 


https://reviews.llvm.org/D41006





More information about the llvm-commits mailing list