[llvm] [X86] Fix store MMO offset in breakBlockedCopies (PR #202904)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 10 02:38:55 PDT 2026
https://github.com/adalal-2441 created https://github.com/llvm/llvm-project/pull/202904
The final buildCopies call in breakBlockedCopies passed LMMOffset for both the load and store MachineMemOperand offsets. The store argument should be SMMOffset. This is NFC today since LMMOffset and SMMOffset values were anyways equal before, but the duplication was a latent bug.
Found via @jlebar's X86 LLVM bug hunt / FuzzX effort: https://github.com/SemiAnalysisAI/FuzzX/blob/master/x86/bugs/042-sfb-buildcopies-wrong-mmo-offset/NOTES.md
cc @jlebar
>From 6fa06212fe4ebd7b2dea0a5395df01bbb5dfa86a Mon Sep 17 00:00:00 2001
From: Akshat <adalal at amd.com>
Date: Wed, 10 Jun 2026 14:21:10 +0530
Subject: [PATCH] [X86] Fix store MMO offset in breakBlockedCopies tail copy
The final buildCopies call in breakBlockedCopies passed LMMOffset for both
the load and store MachineMemOperand offsets. The store argument should be
SMMOffset. This is NFC today since LMMOffset and SMMOffset are advanced in
lockstep and are always equal, but the duplication was a latent bug.
---
llvm/lib/Target/X86/X86AvoidStoreForwardingBlocks.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/llvm/lib/Target/X86/X86AvoidStoreForwardingBlocks.cpp b/llvm/lib/Target/X86/X86AvoidStoreForwardingBlocks.cpp
index 044a951bc7c3e..e3b3066747a84 100644
--- a/llvm/lib/Target/X86/X86AvoidStoreForwardingBlocks.cpp
+++ b/llvm/lib/Target/X86/X86AvoidStoreForwardingBlocks.cpp
@@ -612,7 +612,7 @@ void X86AvoidSFBImpl::breakBlockedCopies(
}
unsigned Size3 = (LdDispImm + getRegSizeInBytes(LoadInst)) - LdDisp1;
buildCopies(Size3, LoadInst, LdDisp1, StoreInst, StDisp1, LMMOffset,
- LMMOffset);
+ SMMOffset);
}
static bool hasSameBaseOpValue(MachineInstr *LoadInst,
More information about the llvm-commits
mailing list