[PATCH] D39637: [GVN PRE] Patch the source for Phi node in PRE

Daniel Berlin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 8 15:40:43 PST 2017


dberlin added a comment.

In load PRE, it is replacing the value of a load with a phi of other values.

As you said, it does not consider nsw while value numbering.

Imagine a load of a phi that  value numbering considers equivalent to

pred1:
1= add nsw, something

pred2:
2 = add something

Despite the difference in flags, it will consider these to be okay values to phi together, and use to replace the load.

So it will generate phi(1, 2) and use it to replace the load.

This is precisely the same thing happening with scalar pre, in this testcase (the insertion it performs is irrelevant).

Hence my question is whether this is magically more okay than what was happening in  the scalar pre case.

I think the answer is no, it's not okay, and needs to be fixed, but am not sure :)


https://reviews.llvm.org/D39637





More information about the llvm-commits mailing list