Igor Gorban 3a8a43f224
[AArch64][GlobalISel] Fix matchUseVectorTruncate to check element order before folding (#185834)
matchUseVectorTruncate incorrectly folded a
G_UNMERGE_VALUES + G_TRUNC + G_BUILD_VECTOR sequence into a single
vector G_TRUNC even when the BUILD_VECTOR operand order did not match
the UNMERGE_VALUES result order. This silently dropped element
reordering, producing a miscompile.

Add an element-ordering check: BUILD_VECTOR position I must use
UNMERGE_VALUES result I, otherwise the fold is rejected.
2026-03-11 15:33:09 +00:00
..