[all-commits] [llvm/llvm-project] 420cf6: [LSV] Return same bitwidth from getConstantOffset.

Justin Lebar via All-commits all-commits at lists.llvm.org
Mon May 29 08:44:25 PDT 2023

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 420cf6927c35449f234549389e6ce18371cdda24
  Author: Justin Lebar <justin.lebar at gmail.com>
  Date:   2023-05-29 (Mon, 29 May 2023)

  Changed paths:
    M llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp
    M llvm/test/Transforms/LoadStoreVectorizer/AMDGPU/vect-ptr-ptr-size-mismatch.ll

  Log Message:
  [LSV] Return same bitwidth from getConstantOffset.

Previously, getConstantOffset could return an APInt with a different
bitwidth than the input pointers.  For example, we might be loading an
opaque 64-bit pointer, but stripAndAccumulateInBoundsConstantOffsets
might give a 32-bit offset.

This was OK in most cases because in gatherChains, we casted the APInt
back to the original ASPtrBits.

But it was not OK when considering selects.  We'd call getConstantOffset
twice and compare the resulting APInt's, which might not have the same
bit width.

This fixes that.  Now getConstantOffset always returns offsets with the
correct width, so we don't need the hack of casting it in gatherChains,
and it works correctly when we're handling selects.

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

More information about the All-commits mailing list