Skip to content

Commit c36fe42

Browse files
committed
Change function name to shouldInsertTrailingSeqCstFenceForAtomicStore
Update comment as well. Change-Id: If5929f66da99cf9750c9c5f73aed295c2a5cf734
1 parent f68de4c commit c36fe42

File tree

4 files changed

+14
-10
lines changed

4 files changed

+14
-10
lines changed

llvm/include/llvm/CodeGen/TargetLowering.h

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2235,6 +2235,14 @@ class LLVM_ABI TargetLoweringBase {
22352235
return false;
22362236
}
22372237

2238+
/// Whether AtomicExpandPass should automatically insert a seq_cst trailing
2239+
/// fence without reducing the ordering for this atomic store. Defaults to
2240+
/// false.
2241+
virtual bool
2242+
shouldInsertTrailingSeqCstFenceForAtomicStore(const Instruction *I) const {
2243+
return false;
2244+
}
2245+
22382246
// The memory ordering that AtomicExpandPass should assign to a atomic
22392247
// instruction that it has lowered by adding fences. This can be used
22402248
// to "fold" one of the fences into the atomic instruction.
@@ -2243,12 +2251,6 @@ class LLVM_ABI TargetLoweringBase {
22432251
return AtomicOrdering::Monotonic;
22442252
}
22452253

2246-
/// Whether AtomicExpandPass should automatically insert a trailing fence
2247-
/// without reducing the ordering for this atomic. Defaults to false.
2248-
virtual bool storeNeedsSeqCstTrailingFence(const Instruction *I) const {
2249-
return false;
2250-
}
2251-
22522254
/// Perform a load-linked operation on Addr, returning a "Value *" with the
22532255
/// corresponding pointee type. This may entail some non-trivial operations to
22542256
/// truncate or reconstruct types that will be illegal in the backend. See

llvm/lib/CodeGen/AtomicExpandPass.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ bool AtomicExpandImpl::processAtomicInstr(Instruction *I) {
345345
if (FenceOrdering != AtomicOrdering::Monotonic) {
346346
MadeChange |= bracketInstWithFences(I, FenceOrdering);
347347
}
348-
} else if (TLI->storeNeedsSeqCstTrailingFence(I) &&
348+
} else if (TLI->shouldInsertTrailingSeqCstFenceForAtomicStore(I) &&
349349
!(CASI && TLI->shouldExpandAtomicCmpXchgInIR(CASI) ==
350350
TargetLoweringBase::AtomicExpansionKind::LLSC)) {
351351
// CmpXchg LLSC is handled in expandAtomicCmpXchg().
@@ -1503,7 +1503,8 @@ bool AtomicExpandImpl::expandAtomicCmpXchg(AtomicCmpXchgInst *CI) {
15031503
// Make sure later instructions don't get reordered with a fence if
15041504
// necessary.
15051505
Builder.SetInsertPoint(SuccessBB);
1506-
if (ShouldInsertFencesForAtomic || TLI->storeNeedsSeqCstTrailingFence(CI))
1506+
if (ShouldInsertFencesForAtomic ||
1507+
TLI->shouldInsertTrailingSeqCstFenceForAtomicStore(CI))
15071508
TLI->emitTrailingFence(Builder, CI, SuccessOrder);
15081509
Builder.CreateBr(ExitBB);
15091510

llvm/lib/Target/AArch64/AArch64ISelLowering.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29446,7 +29446,7 @@ bool AArch64TargetLowering::shouldInsertFencesForAtomic(
2944629446
return false;
2944729447
}
2944829448

29449-
bool AArch64TargetLowering::storeNeedsSeqCstTrailingFence(
29449+
bool AArch64TargetLowering::shouldInsertTrailingSeqCstFenceForAtomicStore(
2945029450
const Instruction *I) const {
2945129451
// Store-Release instructions only provide seq_cst guarantees when paired with
2945229452
// Load-Acquire instructions. MSVC CRT does not use these instructions to

llvm/lib/Target/AArch64/AArch64ISelLowering.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,8 @@ class AArch64TargetLowering : public TargetLowering {
349349
bool isOpSuitableForLSE128(const Instruction *I) const;
350350
bool isOpSuitableForRCPC3(const Instruction *I) const;
351351
bool shouldInsertFencesForAtomic(const Instruction *I) const override;
352-
bool storeNeedsSeqCstTrailingFence(const Instruction *I) const override;
352+
bool shouldInsertTrailingSeqCstFenceForAtomicStore(
353+
const Instruction *I) const override;
353354

354355
TargetLoweringBase::AtomicExpansionKind
355356
shouldExpandAtomicLoadInIR(LoadInst *LI) const override;

0 commit comments

Comments
 (0)