[llvm] [RISCV] Tuple intrinsics are creating overly aligned memory operands (PR #115804)

Pengcheng Wang via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 11 19:28:23 PST 2024


================
@@ -1623,10 +1623,17 @@ bool RISCVTargetLowering::getTgtMemIntrinsic(IntrinsicInfo &Info,
       MemTy = MemTy->getScalarType();
 
     Info.memVT = getValueType(DL, MemTy);
-    if (MemTy->isTargetExtTy())
+    if (MemTy->isTargetExtTy()) {
+      // RISC-V vector tuple type's alignment type should be its element type.
+      if (cast<TargetExtType>(MemTy)->getName() == "riscv.vector.tuple")
+        MemTy = Type::getIntNTy(
+            MemTy->getContext(),
+            1 << cast<ConstantInt>(I.getArgOperand(I.arg_size() - 1))
+                     ->getZExtValue());
       Info.align = DL.getABITypeAlign(MemTy);
-    else
+    } else {
       Info.align = Align(DL.getTypeSizeInBits(MemTy->getScalarType()) / 8);
+    }
----------------
wangpc-pp wrote:

We don't need braces for else if understand coding style correctly.

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


More information about the llvm-commits mailing list