[llvm] [RISCV][GlobalISel] Legalize Scalable Vector Loads and Stores (PR #84965)

Jiahan Xie via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 26 11:18:50 PDT 2024


================
@@ -3330,16 +3330,17 @@ LegalizerHelper::LegalizeResult LegalizerHelper::lowerLoad(GAnyLoad &LoadMI) {
   LLT MemTy = MMO.getMemoryType();
   MachineFunction &MF = MIRBuilder.getMF();
 
-  unsigned MemSizeInBits = MemTy.getSizeInBits();
-  unsigned MemStoreSizeInBits = 8 * MemTy.getSizeInBytes();
+  unsigned MinMemSizeInBits = MemTy.getSizeInBits().getKnownMinValue();
----------------
jiahanxie353 wrote:

Understood.
I used `getKnownMinValue` because we have cases for doing scalar arithmetic operations below. For example:
https://github.com/llvm/llvm-project/blob/9ce3a848fddb3cdc40f47ae35dae205d49459fb3/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp#L3397-L3411

 `bit_floor` has to take a scalar.

So are you suggesting we make them `TypeSize MemSizeInBits` but call `getKnownMinValue` on demand?

https://github.com/llvm/llvm-project/pull/84965


More information about the llvm-commits mailing list