[llvm] [Uniformity] Avoid marking all PHIs as divergent in join blocks (PR #157808)

Carl Ritson via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 25 02:51:59 PDT 2025


perlfu wrote:

> What I suspect the change should really be doing is to open-code `isConstantOrUndefValuePhi`, but skip over predecessors that aren't on any of the diverged paths.

I agree.  I already had the feeling that half of this was open coding `isConstantOrUndefValuePhi`.
I have reworked the methodology inline with that.

There is now one test change where I PHI becomes uniform.
I *think* this case is correct, but have not spent too much time on it.

One oddity is that `hasConstantOrUndefValue` normally ignores self references in PHIs.
I found that apply that logic here produced uniformity results which I didn't agree with.
I have left comments in that indicate where this logic should be, but will remove them if this is merged.


https://github.com/llvm/llvm-project/pull/157808


More information about the llvm-commits mailing list