[llvm] 755c28a - [GISel][Mips] Infer alignment when creating memory operand for G_VASTART. (#74004)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 30 19:55:30 PST 2023
Author: Craig Topper
Date: 2023-11-30T19:55:23-08:00
New Revision: 755c28a9401536d89601ae3582f44be1746fadb6
URL: https://github.com/llvm/llvm-project/commit/755c28a9401536d89601ae3582f44be1746fadb6
DIFF: https://github.com/llvm/llvm-project/commit/755c28a9401536d89601ae3582f44be1746fadb6.diff
LOG: [GISel][Mips] Infer alignment when creating memory operand for G_VASTART. (#74004)
Added:
Modified:
llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
llvm/test/CodeGen/Mips/GlobalISel/irtranslator/var_arg.ll
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp b/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
index 3753b6d540f1b30..14a4e72152e7c43 100644
--- a/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
@@ -81,6 +81,7 @@
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetIntrinsicInfo.h"
#include "llvm/Target/TargetMachine.h"
+#include "llvm/Transforms/Utils/Local.h"
#include "llvm/Transforms/Utils/MemoryOpRemark.h"
#include <algorithm>
#include <cassert>
@@ -2067,12 +2068,12 @@ bool IRTranslator::translateKnownIntrinsic(const CallInst &CI, Intrinsic::ID ID,
auto &TLI = *MF->getSubtarget().getTargetLowering();
Value *Ptr = CI.getArgOperand(0);
unsigned ListSize = TLI.getVaListSizeInBits(*DL) / 8;
+ Align Alignment = getKnownAlignment(Ptr, *DL);
- // FIXME: Get alignment
MIRBuilder.buildInstr(TargetOpcode::G_VASTART, {}, {getOrCreateVReg(*Ptr)})
.addMemOperand(MF->getMachineMemOperand(MachinePointerInfo(Ptr),
MachineMemOperand::MOStore,
- ListSize, Align(1)));
+ ListSize, Alignment));
return true;
}
case Intrinsic::dbg_value: {
diff --git a/llvm/test/CodeGen/Mips/GlobalISel/irtranslator/var_arg.ll b/llvm/test/CodeGen/Mips/GlobalISel/irtranslator/var_arg.ll
index 90032372bd46edb..3e7eb15a22a2d49 100644
--- a/llvm/test/CodeGen/Mips/GlobalISel/irtranslator/var_arg.ll
+++ b/llvm/test/CodeGen/Mips/GlobalISel/irtranslator/var_arg.ll
@@ -27,7 +27,7 @@ define void @testVaCopyArg(ptr %fmt, ...) {
; MIPS32-NEXT: [[FRAME_INDEX5:%[0-9]+]]:_(p0) = G_FRAME_INDEX %stack.2.aq
; MIPS32-NEXT: [[FRAME_INDEX6:%[0-9]+]]:_(p0) = G_FRAME_INDEX %stack.3.s
; MIPS32-NEXT: G_STORE [[COPY]](p0), [[FRAME_INDEX3]](p0) :: (store (p0) into %ir.fmt.addr)
- ; MIPS32-NEXT: G_VASTART [[FRAME_INDEX4]](p0) :: (store (s32) into %ir.ap, align 1)
+ ; MIPS32-NEXT: G_VASTART [[FRAME_INDEX4]](p0) :: (store (s32) into %ir.ap)
; MIPS32-NEXT: G_INTRINSIC_W_SIDE_EFFECTS intrinsic(@llvm.va_copy), [[FRAME_INDEX5]](p0), [[FRAME_INDEX4]](p0)
; MIPS32-NEXT: [[LOAD:%[0-9]+]]:_(p0) = G_LOAD [[FRAME_INDEX5]](p0) :: (dereferenceable load (p0) from %ir.aq)
; MIPS32-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 4
More information about the llvm-commits
mailing list