[llvm] Fix to generalize the canSkipClobberingStore (PR #174137)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 1 07:22:27 PST 2026
https://github.com/Bhuvan1527 updated https://github.com/llvm/llvm-project/pull/174137
>From f4f8716a4f2459bb244171d894ba32aefa9bae68 Mon Sep 17 00:00:00 2001
From: bhuvan1527 <balabhuvanvarma at gmail.com>
Date: Thu, 1 Jan 2026 15:24:34 +0530
Subject: [PATCH] Fix to generalize the canSkipClobberingStore
Current code of canSkipClobberingStore is only skipping the store, if its
value operand is an output of a load instruction. That is it is specific.
This pr is an attempt to generalize this condition and include if the operand is
a constant or a function argument.
---
llvm/lib/Analysis/MemoryDependenceAnalysis.cpp | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp b/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp
index 9a022d9ed09ce..240c45fabc75a 100644
--- a/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp
+++ b/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp
@@ -355,6 +355,11 @@ static bool canSkipClobberingStore(const StoreInst *SI,
MemLoc.Size.getValue().getKnownMinValue())
return false;
+ auto *StoredVal = SI->getValueOperand();
+ if (isa<Argument>(StoredVal)) {
+ return true;
+ }
+
auto *LI = dyn_cast<LoadInst>(SI->getValueOperand());
if (!LI || LI->getParent() != SI->getParent())
return false;
More information about the llvm-commits
mailing list