diff options
author | Fangrui Song <i@maskray.me> | 2021-08-04 12:45:17 -0700 |
---|---|---|
committer | Fangrui Song <i@maskray.me> | 2021-08-04 12:45:18 -0700 |
commit | a1944386156dbbfae15dfc606a3728e08ac92cfe (patch) | |
tree | 25fda9656217854430368d6e913d350d077e9c71 /llvm/lib/CodeGen/TargetLoweringBase.cpp | |
parent | 5edc886e900b12286ad86268461a3013c329118d (diff) | |
download | llvm-a1944386156dbbfae15dfc606a3728e08ac92cfe.zip llvm-a1944386156dbbfae15dfc606a3728e08ac92cfe.tar.gz llvm-a1944386156dbbfae15dfc606a3728e08ac92cfe.tar.bz2 |
[CodeGen] Add -align-loops
to `lib/CodeGen/CommandFlags.cpp`. It can replace
-x86-experimental-pref-loop-alignment=.
The loop alignment is only used by MachineBlockPlacement.
The implementation uses a new `llvm::TargetOptions` for now, as
an IR function attribute/module flags metadata may be overkill.
This is the llvm part of D106701.
Diffstat (limited to 'llvm/lib/CodeGen/TargetLoweringBase.cpp')
-rw-r--r-- | llvm/lib/CodeGen/TargetLoweringBase.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/TargetLoweringBase.cpp b/llvm/lib/CodeGen/TargetLoweringBase.cpp index 842280a..cfbbba6 100644 --- a/llvm/lib/CodeGen/TargetLoweringBase.cpp +++ b/llvm/lib/CodeGen/TargetLoweringBase.cpp @@ -52,6 +52,7 @@ #include "llvm/Support/MachineValueType.h" #include "llvm/Support/MathExtras.h" #include "llvm/Target/TargetMachine.h" +#include "llvm/Target/TargetOptions.h" #include "llvm/Transforms/Utils/SizeOpts.h" #include <algorithm> #include <cassert> @@ -2018,6 +2019,12 @@ bool TargetLoweringBase::isJumpTableRelative() const { return getTargetMachine().isPositionIndependent(); } +Align TargetLoweringBase::getPrefLoopAlignment(MachineLoop *ML) const { + if (TM.Options.LoopAlignment) + return Align(TM.Options.LoopAlignment); + return PrefLoopAlignment; +} + //===----------------------------------------------------------------------===// // Reciprocal Estimates //===----------------------------------------------------------------------===// |