[PATCH] D85584: AMDGPU/GlobalISel: Legalize odd sized loads with widening

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 17 08:05:27 PDT 2020


foad added inline comments.


================
Comment at: llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp:2303-2308
+  if (Ty.isVector()) {
+    const LLT EltTy = Ty.getElementType();
+    return LLT::vector(PowerOf2Ceil(Ty.getNumElements()), EltTy);
+  }
+
+  return LLT::scalar(PowerOf2Ceil(Ty.getSizeInBits()));
----------------
arsenm wrote:
> foad wrote:
> > `Ty.changeElementSize(PowerOf2Ceil(Ty.getScalarSizeInBits()))`?
> I think that should only be used to handle cases that could be a vector or not, but it’s known scalar here  so doesn’t save code 
I meant as a replacement for all of lines 2303-2308, but now I see that in the vector case you're increasing the number of elements, not the size of each element.

Could use `Ty.changeNumElements(PowerOf2Ceil(Ty.getNumElements()))` in the vector case.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D85584/new/

https://reviews.llvm.org/D85584



More information about the llvm-commits mailing list