[llvm] r371210 - [Alignment][NFC] Use Align with TargetLowering::setPrefLoopAlignment
Guillaume Chatelet via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 6 07:51:15 PDT 2019
Author: gchatelet
Date: Fri Sep 6 07:51:15 2019
New Revision: 371210
URL: http://llvm.org/viewvc/llvm-project?rev=371210&view=rev
Log:
[Alignment][NFC] Use Align with TargetLowering::setPrefLoopAlignment
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, hiraditya, kbarton, MaskRay, jsji, ychen, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D67278
Modified:
llvm/trunk/include/llvm/CodeGen/TargetLowering.h
llvm/trunk/lib/Target/AArch64/AArch64ISelLowering.cpp
llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp
llvm/trunk/lib/Target/Hexagon/HexagonISelLowering.cpp
llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp
llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
Modified: llvm/trunk/include/llvm/CodeGen/TargetLowering.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/TargetLowering.h?rev=371210&r1=371209&r2=371210&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/TargetLowering.h (original)
+++ llvm/trunk/include/llvm/CodeGen/TargetLowering.h Fri Sep 6 07:51:15 2019
@@ -2116,13 +2116,10 @@ protected:
PrefFunctionAlignment = llvm::Align(1ULL << LogAlign);
}
- /// Set the target's preferred loop alignment. Default alignment is zero, it
- /// means the target does not care about loop alignment. The alignment is
- /// specified in log2(bytes). The target may also override
- /// getPrefLoopAlignment to provide per-loop values.
- void setPrefLoopLogAlignment(unsigned LogAlign) {
- PrefLoopAlignment = llvm::Align(1ULL << LogAlign);
- }
+ /// Set the target's preferred loop alignment. Default alignment is one, it
+ /// means the target does not care about loop alignment. The target may also
+ /// override getPrefLoopAlignment to provide per-loop values.
+ void setPrefLoopAlignment(llvm::Align Align) { PrefLoopAlignment = Align; }
/// Set the minimum stack alignment of an argument.
void setMinStackArgumentAlignment(unsigned Align) {
Modified: llvm/trunk/lib/Target/AArch64/AArch64ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/AArch64ISelLowering.cpp?rev=371210&r1=371209&r2=371210&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AArch64/AArch64ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/AArch64/AArch64ISelLowering.cpp Fri Sep 6 07:51:15 2019
@@ -643,7 +643,7 @@ AArch64TargetLowering::AArch64TargetLowe
setMinFunctionAlignment(llvm::Align(4));
// Set preferred alignments.
setPrefFunctionLogAlignment(STI.getPrefFunctionLogAlignment());
- setPrefLoopLogAlignment(STI.getPrefLoopLogAlignment());
+ setPrefLoopAlignment(llvm::Align(1ULL << STI.getPrefLoopLogAlignment()));
// 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/ARM/ARMISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=371210&r1=371209&r2=371210&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Fri Sep 6 07:51:15 2019
@@ -1419,7 +1419,8 @@ ARMTargetLowering::ARMTargetLowering(con
// Prefer likely predicted branches to selects on out-of-order cores.
PredictableSelectIsExpensive = Subtarget->getSchedModel().isOutOfOrder();
- setPrefLoopLogAlignment(Subtarget->getPrefLoopLogAlignment());
+ setPrefLoopAlignment(
+ llvm::Align(1UL << Subtarget->getPrefLoopLogAlignment()));
setMinFunctionAlignment(Subtarget->isThumb() ? llvm::Align(2)
: llvm::Align(4));
Modified: llvm/trunk/lib/Target/Hexagon/HexagonISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Hexagon/HexagonISelLowering.cpp?rev=371210&r1=371209&r2=371210&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Hexagon/HexagonISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/Hexagon/HexagonISelLowering.cpp Fri Sep 6 07:51:15 2019
@@ -1235,7 +1235,7 @@ HexagonTargetLowering::HexagonTargetLowe
Subtarget(ST) {
auto &HRI = *Subtarget.getRegisterInfo();
- setPrefLoopLogAlignment(4);
+ setPrefLoopAlignment(llvm::Align(16));
setPrefFunctionLogAlignment(4);
setMinFunctionAlignment(llvm::Align(4));
setStackPointerRegisterToSaveRestore(HRI.getStackRegister());
Modified: llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp?rev=371210&r1=371209&r2=371210&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp Fri Sep 6 07:51:15 2019
@@ -1200,7 +1200,7 @@ PPCTargetLowering::PPCTargetLowering(con
case PPC::DIR_PWR8:
case PPC::DIR_PWR9:
setPrefFunctionLogAlignment(4);
- setPrefLoopLogAlignment(4);
+ setPrefLoopAlignment(llvm::Align(16));
break;
}
Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=371210&r1=371209&r2=371210&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Fri Sep 6 07:51:15 2019
@@ -73,9 +73,10 @@ cl::opt<bool> ExperimentalVectorWidening
static cl::opt<int> ExperimentalPrefLoopAlignment(
"x86-experimental-pref-loop-alignment", cl::init(4),
- cl::desc("Sets the preferable loop alignment for experiments "
- "(the last x86-experimental-pref-loop-alignment bits"
- " of the loop header PC will be 0)."),
+ cl::desc(
+ "Sets the preferable loop alignment for experiments (as log2 bytes)"
+ "(the last x86-experimental-pref-loop-alignment bits"
+ " of the loop header PC will be 0)."),
cl::Hidden);
// Added in 10.0.
@@ -1892,7 +1893,7 @@ X86TargetLowering::X86TargetLowering(con
MaxLoadsPerMemcmpOptSize = 2;
// Set loop alignment to 2^ExperimentalPrefLoopAlignment bytes (default: 2^4).
- setPrefLoopLogAlignment(ExperimentalPrefLoopAlignment);
+ setPrefLoopAlignment(llvm::Align(1UL << ExperimentalPrefLoopAlignment));
// An out-of-order CPU can speculatively execute past a predictable branch,
// but a conditional move could be stalled by an expensive earlier operation.
More information about the llvm-commits
mailing list