aboutsummaryrefslogtreecommitdiff
path: root/llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp
diff options
context:
space:
mode:
authorJay Foad <jay.foad@amd.com>2024-04-26 10:28:52 +0100
committerGitHub <noreply@github.com>2024-04-26 10:28:52 +0100
commit6578356a4e3e6acd7983c74feab43ac96925894c (patch)
tree80f9d1f8cd0d199650b679f1ce664be3f6a504cf /llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp
parent15f02723d49be9a828fbf072966a225babd60457 (diff)
downloadllvm-6578356a4e3e6acd7983c74feab43ac96925894c.zip
llvm-6578356a4e3e6acd7983c74feab43ac96925894c.tar.gz
llvm-6578356a4e3e6acd7983c74feab43ac96925894c.tar.bz2
[TableGen] Ignore inaccessible memory when checking pattern flags (#90061)
In the AMDGPU backend we have some cases where we'd like to mark an intrinsic as IntrInaccessibleMemOnly to model dependencies, but the corresponding MachineInstrs use uses/defs of a special physical register to express the same thing. In this case TableGen would complain: Pattern doesn't match mayLoad/mayStore = 0 but the error is not useful.
Diffstat (limited to 'llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp')
-rw-r--r--llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp b/llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp
index 88d353e..e0e3173 100644
--- a/llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp
+++ b/llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp
@@ -3616,7 +3616,15 @@ public:
hasChain = true;
if (const CodeGenIntrinsic *IntInfo = N.getIntrinsicInfo(CDP)) {
- ModRefInfo MR = IntInfo->ME.getModRef();
+ // Ignore reads/writes to inaccessible memory. These should not imply
+ // mayLoad/mayStore on the instruction because they are often used to
+ // model dependencies that Machine IR expresses as uses/defs of a
+ // special physical register.
+ ModRefInfo MR = ModRefInfo::NoModRef;
+ for (MemoryEffects::Location Loc : MemoryEffects::locations()) {
+ if (Loc != MemoryEffects::Location::InaccessibleMem)
+ MR |= IntInfo->ME.getModRef();
+ }
// If this is an intrinsic, analyze it.
if (isRefSet(MR))
mayLoad = true; // These may load memory.