Skip to content

Commit 6578356

Browse files
authored
[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.
1 parent 15f0272 commit 6578356

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3616,7 +3616,15 @@ class InstAnalyzer {
36163616
hasChain = true;
36173617

36183618
if (const CodeGenIntrinsic *IntInfo = N.getIntrinsicInfo(CDP)) {
3619-
ModRefInfo MR = IntInfo->ME.getModRef();
3619+
// Ignore reads/writes to inaccessible memory. These should not imply
3620+
// mayLoad/mayStore on the instruction because they are often used to
3621+
// model dependencies that Machine IR expresses as uses/defs of a
3622+
// special physical register.
3623+
ModRefInfo MR = ModRefInfo::NoModRef;
3624+
for (MemoryEffects::Location Loc : MemoryEffects::locations()) {
3625+
if (Loc != MemoryEffects::Location::InaccessibleMem)
3626+
MR |= IntInfo->ME.getModRef();
3627+
}
36203628
// If this is an intrinsic, analyze it.
36213629
if (isRefSet(MR))
36223630
mayLoad = true; // These may load memory.

0 commit comments

Comments
 (0)