[SelectionDAG] Add memory size for CSEMap ID calculation
authorAlex MacLean <amaclean@nvidia.com>
Mon, 26 Jun 2023 23:12:43 +0000 (16:12 -0700)
committerCraig Topper <craig.topper@sifive.com>
Mon, 26 Jun 2023 23:12:48 +0000 (16:12 -0700)
commit17aa37dd30ca2d0b85a151c0c8102946a2cdee4b
treece21a8d3876d874556919fe2e6bde68f6000d04c
parent405d6cada4286bf58c2a2ee6858108a34e623b97
[SelectionDAG] Add memory size for CSEMap ID calculation

In NVPTX `ReplaceVectorLoad()`, i1 and i8 types are promoted to i16,
followed by a truncate operation. Thus, v2i8 (or v2i1) and v2i16 will
have the same VTList, which causes a collision in CSEMap.

To differentiate the original VTList, let's add the size in generating
an ID. Otherwise the compiler crashes in refineAlignment:
`MMO->getSize() == getSize() && "Size mismatch!"`

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D153712
llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
llvm/test/CodeGen/NVPTX/dag-cse.ll [new file with mode: 0644]