[DAG] replaceStoreOfInsertLoad - don't fold if the inserted element is implicitly...
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Mon, 21 Aug 2023 10:21:59 +0000 (11:21 +0100)
committerTobias Hieta <tobias@hieta.se>
Tue, 22 Aug 2023 05:49:44 +0000 (07:49 +0200)
commitb4bb394ac4c2680a153c80a7c11b3fb1405e914f
treebd85d3c8116bae8e7a82f38f82ba9f9d820ef001
parente1e460373aa8e59f25538818317b37b77f85a66f
[DAG] replaceStoreOfInsertLoad - don't fold if the inserted element is implicitly truncated

D152276 wasn't handling the case where the inserted element is implicitly truncated into the vector - resulting in a i1 element (implicitly truncated from i8) overwriting 8 bits instead of 1 bit.

This patch is intended to be merged into 17.x so I've just disallowed any vector element vs inserted element type mismatch - technically we could be more elegant and permit truncated stores (as long as the store is still byte sized), but the use cases for that are so limited I'd prefer to play it safe for now.

Candidate patch for #64655 17.x merge

Differential Revision: https://reviews.llvm.org/D158366

(cherry picked from commit ba818c4019c550e1a413e1563a05b241b508defd)
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/test/CodeGen/X86/pr64655.ll