[llvm] r256571 - Add command line options to force function/loop alignments.
Chad Rosier via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 29 10:18:07 PST 2015
Author: mcrosier
Date: Tue Dec 29 12:18:07 2015
New Revision: 256571
URL: http://llvm.org/viewvc/llvm-project?rev=256571&view=rev
Log:
Add command line options to force function/loop alignments.
These are being added for testing purposes.
http://reviews.llvm.org/D15648
Modified:
llvm/trunk/lib/CodeGen/MachineBlockPlacement.cpp
llvm/trunk/lib/CodeGen/MachineFunction.cpp
Modified: llvm/trunk/lib/CodeGen/MachineBlockPlacement.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineBlockPlacement.cpp?rev=256571&r1=256570&r2=256571&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineBlockPlacement.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineBlockPlacement.cpp Tue Dec 29 12:18:07 2015
@@ -62,6 +62,11 @@ static cl::opt<unsigned> AlignAllBlock("
"blocks in the function."),
cl::init(0), cl::Hidden);
+static cl::opt<unsigned>
+ AlignAllLoops("align-all-loops",
+ cl::desc("Force the alignment of all loops in the function."),
+ cl::init(0), cl::Hidden);
+
// FIXME: Find a good default for this flag and remove the flag.
static cl::opt<unsigned> ExitBlockBias(
"block-placement-exit-block-bias",
@@ -1329,6 +1334,11 @@ void MachineBlockPlacement::buildCFGChai
if (!L)
continue;
+ if (AlignAllLoops) {
+ ChainBB->setAlignment(AlignAllLoops);
+ continue;
+ }
+
unsigned Align = TLI->getPrefLoopAlignment(L);
if (!Align)
continue; // Don't care about loop alignment.
Modified: llvm/trunk/lib/CodeGen/MachineFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineFunction.cpp?rev=256571&r1=256570&r2=256571&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineFunction.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineFunction.cpp Tue Dec 29 12:18:07 2015
@@ -47,6 +47,11 @@ using namespace llvm;
#define DEBUG_TYPE "codegen"
+static cl::opt<unsigned>
+ AlignAllFunctions("align-all-functions",
+ cl::desc("Force the alignment of all functions."),
+ cl::init(0), cl::Hidden);
+
void MachineFunctionInitializer::anchor() {}
//===----------------------------------------------------------------------===//
@@ -87,6 +92,9 @@ MachineFunction::MachineFunction(const F
Alignment = std::max(Alignment,
STI->getTargetLowering()->getPrefFunctionAlignment());
+ if (AlignAllFunctions)
+ Alignment = AlignAllFunctions;
+
FunctionNumber = FunctionNum;
JumpTableInfo = nullptr;
More information about the llvm-commits
mailing list