[PATCH] D67852: [Alignment] Get DataLayout::StackAlignment as Align
Guillaume Chatelet via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 23 05:02:26 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL372585: [Alignment] Get DataLayout::StackAlignment as Align (authored by gchatelet, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D67852?vs=221079&id=221291#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D67852/new/
https://reviews.llvm.org/D67852
Files:
llvm/trunk/include/llvm/IR/DataLayout.h
llvm/trunk/lib/Target/AArch64/AArch64CallingConvention.cpp
llvm/trunk/lib/Target/ARM/ARMCallingConv.cpp
llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp
Index: llvm/trunk/lib/Target/AArch64/AArch64CallingConvention.cpp
===================================================================
--- llvm/trunk/lib/Target/AArch64/AArch64CallingConvention.cpp
+++ llvm/trunk/lib/Target/AArch64/AArch64CallingConvention.cpp
@@ -40,12 +40,14 @@
MVT LocVT, ISD::ArgFlagsTy &ArgFlags,
CCState &State, unsigned SlotAlign) {
unsigned Size = LocVT.getSizeInBits() / 8;
- unsigned StackAlign =
+ const llvm::Align StackAlign =
State.getMachineFunction().getDataLayout().getStackAlignment();
- unsigned Align = std::min(ArgFlags.getOrigAlign(), StackAlign);
+ const llvm::Align OrigAlign(ArgFlags.getOrigAlign());
+ const llvm::Align Align = std::min(OrigAlign, StackAlign);
for (auto &It : PendingMembers) {
- It.convertToMem(State.AllocateStack(Size, std::max(Align, SlotAlign)));
+ It.convertToMem(State.AllocateStack(
+ Size, std::max((unsigned)Align.value(), SlotAlign)));
State.addLoc(It);
SlotAlign = 1;
}
Index: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp
===================================================================
--- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp
+++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp
@@ -16771,7 +16771,8 @@
// Avoid over-aligning vector parameters. It would require realigning the
// stack and waste space for no real benefit.
- return std::min(DL.getABITypeAlignment(ArgTy), DL.getStackAlignment());
+ return std::min(DL.getABITypeAlignment(ArgTy),
+ (unsigned)DL.getStackAlignment().value());
}
/// Return true if a type is an AAPCS-VFP homogeneous aggregate or one of
Index: llvm/trunk/lib/Target/ARM/ARMCallingConv.cpp
===================================================================
--- llvm/trunk/lib/Target/ARM/ARMCallingConv.cpp
+++ llvm/trunk/lib/Target/ARM/ARMCallingConv.cpp
@@ -193,7 +193,7 @@
// Try to allocate a contiguous block of registers, each of the correct
// size to hold one member.
auto &DL = State.getMachineFunction().getDataLayout();
- unsigned StackAlign = DL.getStackAlignment();
+ unsigned StackAlign = DL.getStackAlignment().value();
unsigned Align = std::min(PendingMembers[0].getExtraInfo(), StackAlign);
ArrayRef<MCPhysReg> RegList;
Index: llvm/trunk/include/llvm/IR/DataLayout.h
===================================================================
--- llvm/trunk/include/llvm/IR/DataLayout.h
+++ llvm/trunk/include/llvm/IR/DataLayout.h
@@ -266,7 +266,11 @@
return StackNaturalAlign && (Align > StackNaturalAlign);
}
- unsigned getStackAlignment() const { return StackNaturalAlign ? StackNaturalAlign->value() : 0; }
+ llvm::Align getStackAlignment() const {
+ assert(StackNaturalAlign && "StackNaturalAlign must be defined");
+ return *StackNaturalAlign;
+ }
+
unsigned getAllocaAddrSpace() const { return AllocaAddrSpace; }
/// Returns the alignment of function pointers, which may or may not be
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67852.221291.patch
Type: text/x-patch
Size: 2996 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190923/d5b8a8f9/attachment.bin>
More information about the llvm-commits
mailing list