[llvm] [AMDGPU][AMDGPULateCodeGenPrepare] Combine scalarized selects back into vector selects (PR #173990)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 30 07:47:32 PST 2025
================
@@ -225,6 +253,20 @@ bool AMDGPULateCodeGenPrepare::run() {
Changed |= LRO.optimizeLiveType(&I, DeadInsts);
}
+ // Combine scalarized selects back into vector selects.
+ // This uses a top-down approach: iterate over bitcasts (i32 vec -> i8 vec)
+ // and collect all select instructions that use extracted elements with a
+ // zero false value. By starting from the bitcast, we process each source
+ // exactly once, avoiding redundant work when multiple selects share a source.
+ if (CombineScalarSelects) {
----------------
arsenm wrote:
This shouldn't be a separate pass over blocks
https://github.com/llvm/llvm-project/pull/173990
More information about the llvm-commits
mailing list