[llvm] [CodeGenPrepare] Consider target memory intrinics as memory use (PR #159638)
Jeffrey Byrnes via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 19 07:52:00 PDT 2025
https://github.com/jrbyrnes updated https://github.com/llvm/llvm-project/pull/159638
>From 4c52b4265dcd498cc1496c21082a370915de432c Mon Sep 17 00:00:00 2001
From: Jeffrey Byrnes <Jeffrey.Byrnes at amd.com>
Date: Thu, 18 Sep 2025 11:59:12 -0700
Subject: [PATCH] [CodeGenPrepare] Consider target memory intrinics as memory
use
Change-Id: Ieebc6e6246e04164bce6b6b425d39e8624aac578
---
llvm/lib/CodeGen/CodeGenPrepare.cpp | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp
index a190f0dac1379..ae499e773e7b2 100644
--- a/llvm/lib/CodeGen/CodeGenPrepare.cpp
+++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp
@@ -5596,6 +5596,20 @@ static bool FindAllMemoryUses(
continue;
}
+ if (IntrinsicInst *II = dyn_cast<IntrinsicInst>(UserI)) {
+ SmallVector<Value *, 2> PtrOps;
+ Type *AccessTy;
+ if (!TLI.getAddrModeArguments(II, PtrOps, AccessTy))
+ return true;
+
+ auto PtrVal = U.get();
+ if (!find(PtrOps, PtrVal))
+ return true;
+
+ MemoryUses.push_back({&U, AccessTy});
+ continue;
+ }
+
if (CallInst *CI = dyn_cast<CallInst>(UserI)) {
if (CI->hasFnAttr(Attribute::Cold)) {
// If this is a cold call, we can sink the addressing calculation into
More information about the llvm-commits
mailing list