[llvm] r371212 - [Alignment][NFC] Use Align with TargetLowering::setPrefFunctionAlignment
Guillaume Chatelet via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 6 08:03:50 PDT 2019
Author: gchatelet
Date: Fri Sep 6 08:03:49 2019
New Revision: 371212
URL: http://llvm.org/viewvc/llvm-project?rev=371212&view=rev
Log:
[Alignment][NFC] Use Align with TargetLowering::setPrefFunctionAlignment
Summary:
This is patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790
Reviewers: courbet
Subscribers: nemanjai, javed.absar, hiraditya, kbarton, asb, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, jrtc27, MaskRay, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, PkmX, jocewei, jsji, s.egerton, pzheng, ychen, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D67267
Modified:
llvm/trunk/include/llvm/CodeGen/TargetLowering.h
llvm/trunk/lib/Target/AArch64/AArch64ISelLowering.cpp
llvm/trunk/lib/Target/BPF/BPFISelLowering.cpp
llvm/trunk/lib/Target/Hexagon/HexagonISelLowering.cpp
llvm/trunk/lib/Target/Lanai/LanaiISelLowering.cpp
llvm/trunk/lib/Target/MSP430/MSP430ISelLowering.cpp
llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp
llvm/trunk/lib/Target/RISCV/RISCVISelLowering.cpp
llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.cpp
llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp
Modified: llvm/trunk/include/llvm/CodeGen/TargetLowering.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/TargetLowering.h?rev=371212&r1=371211&r2=371212&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/TargetLowering.h (original)
+++ llvm/trunk/include/llvm/CodeGen/TargetLowering.h Fri Sep 6 08:03:49 2019
@@ -2110,10 +2110,9 @@ protected:
}
/// Set the target's preferred function alignment. This should be set if
- /// there is a performance benefit to higher-than-minimum alignment (in
- /// log2(bytes))
- void setPrefFunctionLogAlignment(unsigned LogAlign) {
- PrefFunctionAlignment = llvm::Align(1ULL << LogAlign);
+ /// there is a performance benefit to higher-than-minimum alignment
+ void setPrefFunctionAlignment(llvm::Align Align) {
+ PrefFunctionAlignment = Align;
}
/// Set the target's preferred loop alignment. Default alignment is one, it
Modified: llvm/trunk/lib/Target/AArch64/AArch64ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/AArch64ISelLowering.cpp?rev=371212&r1=371211&r2=371212&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AArch64/AArch64ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/AArch64/AArch64ISelLowering.cpp Fri Sep 6 08:03:49 2019
@@ -642,8 +642,9 @@ AArch64TargetLowering::AArch64TargetLowe
// Set required alignment.
setMinFunctionAlignment(llvm::Align(4));
// Set preferred alignments.
- setPrefFunctionLogAlignment(STI.getPrefFunctionLogAlignment());
setPrefLoopAlignment(llvm::Align(1ULL << STI.getPrefLoopLogAlignment()));
+ setPrefFunctionAlignment(
+ llvm::Align(1ULL << STI.getPrefFunctionLogAlignment()));
// Only change the limit for entries in a jump table if specified by
// the sub target, but not at the command line.
Modified: llvm/trunk/lib/Target/BPF/BPFISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/BPF/BPFISelLowering.cpp?rev=371212&r1=371211&r2=371212&view=diff
==============================================================================
--- llvm/trunk/lib/Target/BPF/BPFISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/BPF/BPFISelLowering.cpp Fri Sep 6 08:03:49 2019
@@ -132,9 +132,9 @@ BPFTargetLowering::BPFTargetLowering(con
setBooleanContents(ZeroOrOneBooleanContent);
- // Function alignments (log2)
+ // Function alignments
setMinFunctionAlignment(llvm::Align(8));
- setPrefFunctionLogAlignment(3);
+ setPrefFunctionAlignment(llvm::Align(8));
if (BPFExpandMemcpyInOrder) {
// LLVM generic code will try to expand memcpy into load/store pairs at this
Modified: llvm/trunk/lib/Target/Hexagon/HexagonISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Hexagon/HexagonISelLowering.cpp?rev=371212&r1=371211&r2=371212&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Hexagon/HexagonISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/Hexagon/HexagonISelLowering.cpp Fri Sep 6 08:03:49 2019
@@ -1236,8 +1236,8 @@ HexagonTargetLowering::HexagonTargetLowe
auto &HRI = *Subtarget.getRegisterInfo();
setPrefLoopAlignment(llvm::Align(16));
- setPrefFunctionLogAlignment(4);
setMinFunctionAlignment(llvm::Align(4));
+ setPrefFunctionAlignment(llvm::Align(16));
setStackPointerRegisterToSaveRestore(HRI.getStackRegister());
setBooleanContents(TargetLoweringBase::UndefinedBooleanContent);
setBooleanVectorContents(TargetLoweringBase::UndefinedBooleanContent);
Modified: llvm/trunk/lib/Target/Lanai/LanaiISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Lanai/LanaiISelLowering.cpp?rev=371212&r1=371211&r2=371212&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Lanai/LanaiISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/Lanai/LanaiISelLowering.cpp Fri Sep 6 08:03:49 2019
@@ -144,9 +144,9 @@ LanaiTargetLowering::LanaiTargetLowering
setTargetDAGCombine(ISD::OR);
setTargetDAGCombine(ISD::XOR);
- // Function alignments (log2)
+ // Function alignments
setMinFunctionAlignment(llvm::Align(4));
- setPrefFunctionLogAlignment(2);
+ setPrefFunctionAlignment(llvm::Align(4));
setJumpIsExpensive(true);
Modified: llvm/trunk/lib/Target/MSP430/MSP430ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MSP430/MSP430ISelLowering.cpp?rev=371212&r1=371211&r2=371212&view=diff
==============================================================================
--- llvm/trunk/lib/Target/MSP430/MSP430ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/MSP430/MSP430ISelLowering.cpp Fri Sep 6 08:03:49 2019
@@ -328,7 +328,7 @@ MSP430TargetLowering::MSP430TargetLoweri
// TODO: __mspabi_srall, __mspabi_srlll, __mspabi_sllll
setMinFunctionAlignment(llvm::Align(2));
- setPrefFunctionLogAlignment(1);
+ setPrefFunctionAlignment(llvm::Align(2));
}
SDValue MSP430TargetLowering::LowerOperation(SDValue Op,
Modified: llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp?rev=371212&r1=371211&r2=371212&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp Fri Sep 6 08:03:49 2019
@@ -1182,7 +1182,7 @@ PPCTargetLowering::PPCTargetLowering(con
setMinFunctionAlignment(llvm::Align(4));
if (Subtarget.isDarwin())
- setPrefFunctionLogAlignment(4);
+ setPrefFunctionAlignment(llvm::Align(16));
switch (Subtarget.getDarwinDirective()) {
default: break;
@@ -1199,8 +1199,8 @@ PPCTargetLowering::PPCTargetLowering(con
case PPC::DIR_PWR7:
case PPC::DIR_PWR8:
case PPC::DIR_PWR9:
- setPrefFunctionLogAlignment(4);
setPrefLoopAlignment(llvm::Align(16));
+ setPrefFunctionAlignment(llvm::Align(16));
break;
}
Modified: llvm/trunk/lib/Target/RISCV/RISCVISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/RISCV/RISCVISelLowering.cpp?rev=371212&r1=371211&r2=371212&view=diff
==============================================================================
--- llvm/trunk/lib/Target/RISCV/RISCVISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/RISCV/RISCVISelLowering.cpp Fri Sep 6 08:03:49 2019
@@ -197,10 +197,10 @@ RISCVTargetLowering::RISCVTargetLowering
setBooleanContents(ZeroOrOneBooleanContent);
- // Function alignments (log2).
+ // Function alignments.
const llvm::Align FunctionAlignment(Subtarget.hasStdExtC() ? 2 : 4);
setMinFunctionAlignment(FunctionAlignment);
- setPrefFunctionLogAlignment(Log2(FunctionAlignment));
+ setPrefFunctionAlignment(FunctionAlignment);
// Effectively disable jump table generation.
setMinimumJumpTableEntries(INT_MAX);
Modified: llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.cpp?rev=371212&r1=371211&r2=371212&view=diff
==============================================================================
--- llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.cpp Fri Sep 6 08:03:49 2019
@@ -122,7 +122,7 @@ SystemZTargetLowering::SystemZTargetLowe
// Instructions are strings of 2-byte aligned 2-byte values.
setMinFunctionAlignment(llvm::Align(2));
// For performance reasons we prefer 16-byte alignment.
- setPrefFunctionLogAlignment(4);
+ setPrefFunctionAlignment(llvm::Align(16));
// Handle operations that are handled in a similar way for all types.
for (unsigned I = MVT::FIRST_INTEGER_VALUETYPE;
Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=371212&r1=371211&r2=371212&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Fri Sep 6 08:03:49 2019
@@ -1899,7 +1899,7 @@ X86TargetLowering::X86TargetLowering(con
// but a conditional move could be stalled by an expensive earlier operation.
PredictableSelectIsExpensive = Subtarget.getSchedModel().isOutOfOrder();
EnableExtLdPromotion = true;
- setPrefFunctionLogAlignment(4); // 2^4 bytes.
+ setPrefFunctionAlignment(llvm::Align(16));
verifyIntrinsicTables();
}
Modified: llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp?rev=371212&r1=371211&r2=371212&view=diff
==============================================================================
--- llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp Fri Sep 6 08:03:49 2019
@@ -172,7 +172,7 @@ XCoreTargetLowering::XCoreTargetLowering
setTargetDAGCombine(ISD::INTRINSIC_W_CHAIN);
setMinFunctionAlignment(llvm::Align(2));
- setPrefFunctionLogAlignment(2);
+ setPrefFunctionAlignment(llvm::Align(4));
}
bool XCoreTargetLowering::isZExtFree(SDValue Val, EVT VT2) const {
More information about the llvm-commits
mailing list