[llvm] [llvm-exegesis] Align loop MBB in loop repetitor (PR #77264)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Jan 7 18:29:56 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-tools-llvm-exegesis
Author: Aiden Grossman (boomanaiden154)
<details>
<summary>Changes</summary>
This patch sets the alignment of the loob MBB in the loop repetitor to 16 to avoid instruction fetch/predecoding bottlenecks that can come up with unaligned code. The value of 16 was chosen based on numbers for recent Intel microarchitectures and reccomendations from Agner Fog.
---
Full diff: https://github.com/llvm/llvm-project/pull/77264.diff
1 Files Affected:
- (modified) llvm/tools/llvm-exegesis/lib/SnippetRepetitor.cpp (+4)
``````````diff
diff --git a/llvm/tools/llvm-exegesis/lib/SnippetRepetitor.cpp b/llvm/tools/llvm-exegesis/lib/SnippetRepetitor.cpp
index cc5a045a8be5dd..2e23351de8e0dc 100644
--- a/llvm/tools/llvm-exegesis/lib/SnippetRepetitor.cpp
+++ b/llvm/tools/llvm-exegesis/lib/SnippetRepetitor.cpp
@@ -74,6 +74,10 @@ class LoopSnippetRepetitor : public SnippetRepetitor {
auto Loop = Filler.addBasicBlock();
auto Exit = Filler.addBasicBlock();
+ // Align the loop machine basic block to a sixteen byte boundary
+ // so that instruction fetch on modern x86 platforms works optimally.
+ Loop.MBB->setAlignment(Align(16));
+
const unsigned LoopUnrollFactor =
LoopBodySize <= Instructions.size()
? 1
``````````
</details>
https://github.com/llvm/llvm-project/pull/77264
More information about the llvm-commits
mailing list