[llvm] [AMDGPU] Fix SIFoldOperands miscompiling values that leave a divergent loop (PR #203256)

via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 30 09:11:38 PDT 2026


carlobertolli wrote:

> Is it possible to hit this issue, but the COPY and use do not fall inside/outside of a loop? @aobolensk and I discussed this privately, but we were not able to come up with a conclusion.

If you don't have a loop, then you can have divergent code with the COPY in a branch and the use in non-divergent code later. In that case, the target of the COPY is not defined for lanes that are excluded by $exec. So folding the COPY would be legal anyway.
Same here: I could not think of any other case. I also think that making up cases is beyond the scope of this PR: we are trying to solve one bug and we can address further examples/bugs later on, once this is merged.

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


More information about the llvm-commits mailing list