[llvm] [llvm-exegesis] Exclude loads/stores from aliasing instruction set (PR #156300)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 1 02:41:25 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-tools-llvm-exegesis
Author: Sjoerd Meijer (sjoerdmeijer)
<details>
<summary>Changes</summary>
In the serial snippet generator and function that computes the aliasing instructions, I don't think we want to include load/store instructions to create a chain as that could make the results more unreliable.
There is a hasMemoryOperands() check, but I think that's an X86 way for checking for loads/stores. For AArch64, we should check mayLoad() and mayStore(), and probably for other architectures too.
---
Full diff: https://github.com/llvm/llvm-project/pull/156300.diff
2 Files Affected:
- (added) llvm/test/tools/llvm-exegesis/AArch64/no-aliasing-ld-str.s (+8)
- (modified) llvm/tools/llvm-exegesis/lib/SerialSnippetGenerator.cpp (+2)
``````````diff
diff --git a/llvm/test/tools/llvm-exegesis/AArch64/no-aliasing-ld-str.s b/llvm/test/tools/llvm-exegesis/AArch64/no-aliasing-ld-str.s
new file mode 100644
index 0000000000000..65e1203bb275d
--- /dev/null
+++ b/llvm/test/tools/llvm-exegesis/AArch64/no-aliasing-ld-str.s
@@ -0,0 +1,8 @@
+REQUIRES: aarch64-registered-target
+
+RUN: llvm-exegesis -mtriple=aarch64 -mcpu=neoverse-v2 -mode=latency --dump-object-to-disk=%d --opcode-name=FMOVWSr --benchmark-phase=assemble-measured-code 2>&1
+RUN: llvm-objdump -d %d > %t.s
+RUN: FileCheck %s < %t.s
+
+CHECK-NOT: ld{{[1-4]}}
+CHECK-NOT: st{{[1-4]}}
diff --git a/llvm/tools/llvm-exegesis/lib/SerialSnippetGenerator.cpp b/llvm/tools/llvm-exegesis/lib/SerialSnippetGenerator.cpp
index bdfc93e22273b..551da570685d2 100644
--- a/llvm/tools/llvm-exegesis/lib/SerialSnippetGenerator.cpp
+++ b/llvm/tools/llvm-exegesis/lib/SerialSnippetGenerator.cpp
@@ -57,6 +57,8 @@ computeAliasingInstructions(const LLVMState &State, const Instruction *Instr,
continue;
if (OtherInstr.hasMemoryOperands())
continue;
+ if (OtherInstr.Description.mayLoad() || OtherInstr.Description.mayStore())
+ continue;
if (!ET.allowAsBackToBack(OtherInstr))
continue;
if (Instr->hasAliasingRegistersThrough(OtherInstr, ForbiddenRegisters))
``````````
</details>
https://github.com/llvm/llvm-project/pull/156300
More information about the llvm-commits
mailing list