[PATCH] D30391: [X86] Add option to specify preferable loop alignment

Serguei Katkov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 26 22:17:55 PST 2017


skatkov updated this revision to Diff 89840.
skatkov retitled this revision from "[X86] Add Experimental option to specify preferable loop alignment" to "[X86] Add option to specify preferable loop alignment".
skatkov added a comment.

Craig, Thank you for the review.

I've updated a change.


https://reviews.llvm.org/D30391

Files:
  lib/Target/X86/X86ISelLowering.cpp


Index: lib/Target/X86/X86ISelLowering.cpp
===================================================================
--- lib/Target/X86/X86ISelLowering.cpp
+++ lib/Target/X86/X86ISelLowering.cpp
@@ -70,6 +70,13 @@
              "rather than promotion."),
     cl::Hidden);
 
+static cl::opt<int> PrefLoopAlignment(
+    "x86-pref-loop-alignment", cl::init(4),
+    cl::desc("Sets the preferable loop alignment "
+             "(the last PrefLoopAlignment bits"
+             " of the loop header PC will be 0)."),
+    cl::Hidden);
+
 X86TargetLowering::X86TargetLowering(const X86TargetMachine &TM,
                                      const X86Subtarget &STI)
     : TargetLowering(TM), Subtarget(STI) {
@@ -1716,7 +1723,8 @@
   MaxStoresPerMemcpyOptSize = 4;
   MaxStoresPerMemmove = 8; // For @llvm.memmove -> sequence of stores
   MaxStoresPerMemmoveOptSize = 4;
-  setPrefLoopAlignment(4); // 2^4 bytes.
+  // Set loop alignment to 2^PrefLoopAlignment bytes (default: 2^4).
+  setPrefLoopAlignment(PrefLoopAlignment);
 
   // An out-of-order CPU can speculatively execute past a predictable branch,
   // but a conditional move could be stalled by an expensive earlier operation.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D30391.89840.patch
Type: text/x-patch
Size: 1180 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170227/bf3ce4e7/attachment.bin>


More information about the llvm-commits mailing list