Skip to content

Commit

Permalink
[ModRef] Default to ModRef in MemoryEffects ctors (NFC)
Browse files Browse the repository at this point in the history
Allow writing something like MemoryEffects::argMemOnly() implying
MemoryEffects::argMemOnly(ModRefInfo::ModRef). Having to write this
out is a bit of an annoying than porting code using the existing
attributes in D135780.
  • Loading branch information
nikic committed Oct 20, 2022
1 parent b1e5e81 commit 9cfe8ee
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions llvm/include/llvm/IR/ModRef.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,17 +129,18 @@ class MemoryEffects {
}

/// Create MemoryEffects that can only access argument memory.
static MemoryEffects argMemOnly(ModRefInfo MR) {
static MemoryEffects argMemOnly(ModRefInfo MR = ModRefInfo::ModRef) {
return MemoryEffects(ArgMem, MR);
}

/// Create MemoryEffects that can only access inaccessible memory.
static MemoryEffects inaccessibleMemOnly(ModRefInfo MR) {
static MemoryEffects inaccessibleMemOnly(ModRefInfo MR = ModRefInfo::ModRef) {
return MemoryEffects(InaccessibleMem, MR);
}

/// Create MemoryEffects that can only access inaccessible or argument memory.
static MemoryEffects inaccessibleOrArgMemOnly(ModRefInfo MR) {
static MemoryEffects
inaccessibleOrArgMemOnly(ModRefInfo MR = ModRefInfo::ModRef) {
MemoryEffects FRMB = none();
FRMB.setModRef(ArgMem, MR);
FRMB.setModRef(InaccessibleMem, MR);
Expand Down

0 comments on commit 9cfe8ee

Please sign in to comment.