[llvm] [InstCombine] Optimize AMDGPU ballot + assume uniformity patterns (PR #160670)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 25 02:37:37 PDT 2025


arsenm wrote:

I don't understand why this is being folded in the context of the assume argument. If we want to do that fold, this is probably not the right place for it.  The assume isn't doing anything here 

> In AMDGPU code, developers often use ballot intrinsics to test uniformity of conditions across a wavefront:

Do they? Does this actually do anything? I attempted to make use of this in https://reviews.llvm.org/D137142, but it was never completed. Did that get separately implemented?

> assume(icmp eq (ballot(cmp), -1))

Isn't the ballot result anded with exec? Such that this assume is only correct for full dispatches at the entry to the kernel? 



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


More information about the llvm-commits mailing list