llvm-project
d858dfbd - [Hexagon] Skip GEP index differences in a non-pointer index type (#238042)

Commit
5 hours ago
[Hexagon] Skip GEP index differences in a non-pointer index type (#238042) calculatePointerDifference() subtracted the indices of two single-index GEPs on the indices as written. Mixed widths (e.g. i64 and i32) assert in BinaryOperator::Create. Narrow widths (e.g. i8) can wrap, so the loads are combined at the wrong offset, which silently reads wrong data. Return std::nullopt unless both indices already have the pointer's index type. Otherwise the loads are not combined. Constant differences that SCEV proves (such as narrow indices with nsw) are still combined. Tests: vector-align-gep-index-types.ll covers mixed index types and the i8 wrap.
Author
Parents
Loading