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

Arseniy Obolenskiy via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 30 05:48:07 PDT 2026


aobolensk wrote:

> > > Please take a look at #136003 which seems to fix exactly the same problem in a different way. Why doesn't it work for your test code? What kind of IR input leads to a COPY-to-vgpr without an `implicit $exec` operand? Which fix should we prefer in the long term? We should not need both of them. Cc @mariusz-sikora-at-amd
> > 
> > 
> > I see two reasons why this case is not fixed by #136003
> > 
> > 1. The COPY's implicit operands is empty
> >    `(OpToFold.DefMI->implicit_operands().empty())` is true
> > 2. `UseMI->isCopy()` is false anyway, because the UseMI is
> >    `%11:vgpr_32 = V_ADD_U32_e64 %9, 1, 0, implicit $exec`
> >    so we never get to even check the implicit operand list.
> 
> Does the current PR also fix the test case from #136003? We should not need both fixes going forward.

I made a check with reverting #136003 `OpToFold.DefMI->implicit_operands().empty()` condition. All tests pass (incl. ones added in #136003)

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


More information about the llvm-commits mailing list