[PATCH] D15648: Add command line options to force function/loop alignments.

Chad Rosier via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 22 14:19:51 PST 2015


mcrosier retitled this revision from "Add command line options to override target preferred/minimum function/loop alignments." to "Add command line options to force function/loop alignments.".
mcrosier updated the summary for this revision.
mcrosier updated this revision to Diff 43485.
mcrosier added a comment.

A more straight forward solution.


http://reviews.llvm.org/D15648

Files:
  lib/CodeGen/MachineBlockPlacement.cpp
  lib/CodeGen/MachineFunction.cpp

Index: lib/CodeGen/MachineFunction.cpp
===================================================================
--- lib/CodeGen/MachineFunction.cpp
+++ lib/CodeGen/MachineFunction.cpp
@@ -47,6 +47,11 @@
 
 #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 @@
     Alignment = std::max(Alignment,
                          STI->getTargetLowering()->getPrefFunctionAlignment());
 
+  if (AlignAllFunctions)
+    Alignment = AlignAllFunctions;
+
   FunctionNumber = FunctionNum;
   JumpTableInfo = nullptr;
 
Index: lib/CodeGen/MachineBlockPlacement.cpp
===================================================================
--- lib/CodeGen/MachineBlockPlacement.cpp
+++ lib/CodeGen/MachineBlockPlacement.cpp
@@ -62,6 +62,11 @@
                                                 "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 @@
     if (!L)
       continue;
 
+    if (AlignAllLoops) {
+      ChainBB->setAlignment(AlignAllLoops);
+      continue;
+    }
+
     unsigned Align = TLI->getPrefLoopAlignment(L);
     if (!Align)
       continue; // Don't care about loop alignment.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15648.43485.patch
Type: text/x-patch
Size: 1799 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151222/77baad0c/attachment.bin>


More information about the llvm-commits mailing list