[llvm-branch-commits] [llvm] [AMDGPU] Use reverse iteration in CodeGenPrepare (PR #145484)
Matt Arsenault via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Tue Jun 24 03:18:46 PDT 2025
arsenm wrote:
> I don't understand the high level motivation here. "Normal" combining/simplification order is to visit the operands of an instruction before you visit the instruction itself.
Pattern matching is bottom up. This is essentially a selection problem, and selection is done bottom up.
> That way the "visit" function can assume that the operands have already been simplified.
This is one of the problems, you want to see the original value before it's been dirtied up by the transformations.
> GlobalISel combines already work this way,
The globalisel combiner is in reverse order.
Doing it in reverse also largely avoids the problem of stale uniformity info. All newly created values are falsely seen as uniform. If you do it in reverse, you don't encounter those new incorrect values
https://github.com/llvm/llvm-project/pull/145484
More information about the llvm-branch-commits
mailing list