[llvm] [IR]+[VectorCombine] Check for integer overflow in ShuffleVectorInst::isValidOperands() (and fix shuffle-of-adjacent-loads.ll) (PR #229306)

Sushant Gokhale via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 6 04:23:01 PDT 2026


================
@@ -1841,7 +1841,7 @@ bool ShuffleVectorInst::isValidOperands(const Value *V1, const Value *V2,
   int V1Size =
----------------
sushgokh wrote:

changing this to `int64_t` should resolve the issue. Note that I am banking on 
`getElementCount().getKnownMinValue()` which returns `unsigned` as of today and hence changing this to `int64_t` works. The concerned test now starts failing. So, you need to change the name of test and regenerate the checks.

Otherwise, just put a check on  combined vector ElementCount in VectorCombine
`WideSz <= INT_MAX/2`



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


More information about the llvm-commits mailing list