[llvm] [CodeGen] Disallow mixing of ignorable uses in MachineCSE (PR #193522)
Igor Wodiany via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 23 04:13:08 PDT 2026
IgWod wrote:
> Are we just saying that exec uses are not ignorable at all (at least for CSE) and we should revert https://github.com/llvm/llvm-project/commit/11e86868c1a1ee67a1d88ef84b68193d06dc996d?
Good question, I didn't consider the wider CSE and exec mask context. Now when I think about I think the answer is: it depends. I believe we can CSE if the instruction that we preserve has a wider mask. I think in this case the particular problem is that the loop will narrow the mask, but after the loop we would potentially have a mask restored to a wider one, so CSE causes some values to be dropped. Going beyond `V_CMP_*` I guess it would be true for any VALU instruction.
So yes, it seems we may want to revert that commit. I can prepare a revert if we have a consensus it's a right course of action. There is probably a scope to implement a smart CSE with exec masks, but that would be a separate task, if deemed beneficial.
Another commit that's relevant is: https://github.com/llvm/llvm-project/commit/a1fb307b4b8d5ffd8f66a477783e362e54a3c03c This causes `V_CMP_*` to be treated as ignorable in this particular context. But if we say execs are not ignorable for CSE at all then this doesn't really mater here.
https://github.com/llvm/llvm-project/pull/193522
More information about the llvm-commits
mailing list