llvm-project
39d7f6b2 - [InstCombine] Check stride preconditions in `foldCmpLoadFromIndexedGlobal` (#234187)

Commit
27 days ago
[InstCombine] Check stride preconditions in `foldCmpLoadFromIndexedGlobal` (#234187) When folding a comparison of a load from a constant global into a comparison on the index in `foldCmpLoadFromIndexedGlobal`, the enumeration of offsets `ConstOffset + Idx * Stride` within the global is assumed to be exhaustive. This holds as long as the stride is positive for nusw GEPs, and it is a power of two for non-nusw GEPs, as `Idx * Stride` may wrap. Neither assumption is guaranteed by the decomposed linear expression, so make sure these are checked explicitly. Fixes: https://github.com/llvm/llvm-project/issues/233092.
Parents
Loading