GlobalISel: Don't try to narrow extending loads/trunc store
authorMatt Arsenault <Matthew.Arsenault@amd.com>
Thu, 13 Feb 2020 20:08:59 +0000 (15:08 -0500)
committerMatt Arsenault <arsenm2@gmail.com>
Wed, 11 Mar 2020 03:34:10 +0000 (23:34 -0400)
commitc0ad75e7587d2e08ba2d5c55311b44ce7f9b20e4
tree59307e9276a9b98abd6c1b149f0d3283074303e0
parentb17a81f8b23b8412c1fa663c9bbe60060a494503
GlobalISel: Don't try to narrow extending loads/trunc store

If the loaded memory size was smaller than the result size, this would
produce out of bounds memory accesses. I'm wondering if we need a
distinct narrow memory legalize action type, since a case I care about
is decomposing a 4-byte unaligned access into 4 extending loads, which
would leave the original result register type. I'm currently awkwardly
using narrowScalar to handle unaligned accesses that need to be split.
llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
llvm/test/CodeGen/AMDGPU/GlobalISel/legalize-load-constant.mir
llvm/test/CodeGen/AMDGPU/GlobalISel/legalize-load-flat.mir
llvm/test/CodeGen/AMDGPU/GlobalISel/legalize-load-global.mir
llvm/test/CodeGen/AMDGPU/GlobalISel/legalize-load-local.mir
llvm/test/CodeGen/AMDGPU/GlobalISel/legalize-load-private.mir
llvm/test/CodeGen/AMDGPU/GlobalISel/legalize-store-global.mir