[llvm] [AMDGPU][AMDGPULateCodeGenPrepare] Combine scalarized selects back into vector selects (PR #173990)

Pankaj Dwivedi via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 30 09:20:11 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) {
----------------
PankajDwivedi-25 wrote:

addressed.

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


More information about the llvm-commits mailing list