[llvm] [VectorCombine] Fix crash when folding select of bitcast (PR #177183)
Pankaj Dwivedi via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 27 10:54:04 PST 2026
================
@@ -0,0 +1,186 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 6
----------------
PankajDwivedi-25 wrote:
> @PankajDwivedi-25, when I run opt on my multi-block cases with `-mtriple=amdgcn-amd-amdhsa -mcpu=gfx942` (flags found in combine-scalar-selects.ll), this optimization doesn't even fire for some reason. See https://godbolt.org/z/nh1bbKxq5.
I think the reason for that is TTI cost-based profitability check in foldSelectsFromBitcast:
```
unsigned MinSelects = (VecSelCost.getValue() / ScalarSelCost.getValue()) + 1;
if (Selects.size() < MinSelects)
continue; // Bails out
```
to add these to `combine-scalar-selects.ll` with AMDGPU flags, you'd need to ensure enough selects per condition to exceed the profitability threshold.
https://github.com/llvm/llvm-project/pull/177183
More information about the llvm-commits
mailing list