Rename "Expand" to "ExpandCustom"
This commit is contained in:
parent
d05704bce4
commit
9cdf588d22
@ -262,14 +262,13 @@ public:
|
|||||||
LLOnly, // Expand the (load) instruction into just a load-linked, which has
|
LLOnly, // Expand the (load) instruction into just a load-linked, which has
|
||||||
// greater atomic guarantees than a normal load.
|
// greater atomic guarantees than a normal load.
|
||||||
CmpXChg, // Expand the instruction into cmpxchg; used by at least X86.
|
CmpXChg, // Expand the instruction into cmpxchg; used by at least X86.
|
||||||
MaskedIntrinsic, // Use a target-specific intrinsic for the LL/SC loop.
|
MaskedIntrinsic, // Use a target-specific intrinsic for the LL/SC loop.
|
||||||
XChg, // Expand a store too large to be atomic into a xchg, then re-process
|
|
||||||
// it.
|
|
||||||
BitTestIntrinsic, // Use a target-specific intrinsic for special bit
|
BitTestIntrinsic, // Use a target-specific intrinsic for special bit
|
||||||
// operations; used by X86.
|
// operations; used by X86.
|
||||||
CmpArithIntrinsic, // Use a target-specific intrinsic for special compare
|
CmpArithIntrinsic, // Use a target-specific intrinsic for special compare
|
||||||
// operations; used by X86.
|
// operations; used by X86.
|
||||||
Expand, // Generic expansion in terms of other atomic operations.
|
Expand, // Generic expansion in terms of other atomic operations.
|
||||||
|
CustomExpand, // Custom target-specific expansion using TLI hooks.
|
||||||
|
|
||||||
// Rewrite to a non-atomic form for use in a known non-preemptible
|
// Rewrite to a non-atomic form for use in a known non-preemptible
|
||||||
// environment.
|
// environment.
|
||||||
@ -2391,8 +2390,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Returns how the given (atomic) store should be expanded by the IR-level
|
/// Returns how the given (atomic) store should be expanded by the IR-level
|
||||||
/// AtomicExpand pass into. For instance AtomicExpansionKind::Expand will try
|
/// AtomicExpand pass into. For instance AtomicExpansionKind::CustomExpand
|
||||||
/// to use an atomicrmw xchg.
|
/// will try to use an atomicrmw xchg.
|
||||||
virtual AtomicExpansionKind shouldExpandAtomicStoreInIR(StoreInst *SI) const {
|
virtual AtomicExpansionKind shouldExpandAtomicStoreInIR(StoreInst *SI) const {
|
||||||
return AtomicExpansionKind::None;
|
return AtomicExpansionKind::None;
|
||||||
}
|
}
|
||||||
|
@ -537,7 +537,7 @@ bool AtomicExpandImpl::tryExpandAtomicLoad(LoadInst *LI) {
|
|||||||
case TargetLoweringBase::AtomicExpansionKind::NotAtomic:
|
case TargetLoweringBase::AtomicExpansionKind::NotAtomic:
|
||||||
LI->setAtomic(AtomicOrdering::NotAtomic);
|
LI->setAtomic(AtomicOrdering::NotAtomic);
|
||||||
return true;
|
return true;
|
||||||
case TargetLoweringBase::AtomicExpansionKind::Expand:
|
case TargetLoweringBase::AtomicExpansionKind::CustomExpand:
|
||||||
TLI->emitExpandAtomicLoad(LI);
|
TLI->emitExpandAtomicLoad(LI);
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
@ -549,10 +549,10 @@ bool AtomicExpandImpl::tryExpandAtomicStore(StoreInst *SI) {
|
|||||||
switch (TLI->shouldExpandAtomicStoreInIR(SI)) {
|
switch (TLI->shouldExpandAtomicStoreInIR(SI)) {
|
||||||
case TargetLoweringBase::AtomicExpansionKind::None:
|
case TargetLoweringBase::AtomicExpansionKind::None:
|
||||||
return false;
|
return false;
|
||||||
case TargetLoweringBase::AtomicExpansionKind::Expand:
|
case TargetLoweringBase::AtomicExpansionKind::CustomExpand:
|
||||||
TLI->emitExpandAtomicStore(SI);
|
TLI->emitExpandAtomicStore(SI);
|
||||||
return true;
|
return true;
|
||||||
case TargetLoweringBase::AtomicExpansionKind::XChg:
|
case TargetLoweringBase::AtomicExpansionKind::Expand:
|
||||||
expandAtomicStoreToXChg(SI);
|
expandAtomicStoreToXChg(SI);
|
||||||
return true;
|
return true;
|
||||||
case TargetLoweringBase::AtomicExpansionKind::NotAtomic:
|
case TargetLoweringBase::AtomicExpansionKind::NotAtomic:
|
||||||
@ -747,7 +747,7 @@ bool AtomicExpandImpl::tryExpandAtomicRMW(AtomicRMWInst *AI) {
|
|||||||
}
|
}
|
||||||
case TargetLoweringBase::AtomicExpansionKind::NotAtomic:
|
case TargetLoweringBase::AtomicExpansionKind::NotAtomic:
|
||||||
return lowerAtomicRMWInst(AI);
|
return lowerAtomicRMWInst(AI);
|
||||||
case TargetLoweringBase::AtomicExpansionKind::Expand:
|
case TargetLoweringBase::AtomicExpansionKind::CustomExpand:
|
||||||
TLI->emitExpandAtomicRMW(AI);
|
TLI->emitExpandAtomicRMW(AI);
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
@ -1701,7 +1701,7 @@ bool AtomicExpandImpl::tryExpandAtomicCmpXchg(AtomicCmpXchgInst *CI) {
|
|||||||
return true;
|
return true;
|
||||||
case TargetLoweringBase::AtomicExpansionKind::NotAtomic:
|
case TargetLoweringBase::AtomicExpansionKind::NotAtomic:
|
||||||
return lowerAtomicCmpXchgInst(CI);
|
return lowerAtomicCmpXchgInst(CI);
|
||||||
case TargetLoweringBase::AtomicExpansionKind::Expand: {
|
case TargetLoweringBase::AtomicExpansionKind::CustomExpand: {
|
||||||
TLI->emitExpandAtomicCmpXchg(CI);
|
TLI->emitExpandAtomicCmpXchg(CI);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -28410,10 +28410,10 @@ AArch64TargetLowering::shouldExpandAtomicStoreInIR(StoreInst *SI) const {
|
|||||||
if (isOpSuitableForRCPC3(SI))
|
if (isOpSuitableForRCPC3(SI))
|
||||||
return AtomicExpansionKind::None;
|
return AtomicExpansionKind::None;
|
||||||
if (isOpSuitableForLSE128(SI))
|
if (isOpSuitableForLSE128(SI))
|
||||||
return AtomicExpansionKind::XChg;
|
return AtomicExpansionKind::Expand;
|
||||||
if (isOpSuitableForLDPSTP(SI))
|
if (isOpSuitableForLDPSTP(SI))
|
||||||
return AtomicExpansionKind::None;
|
return AtomicExpansionKind::None;
|
||||||
return AtomicExpansionKind::XChg;
|
return AtomicExpansionKind::Expand;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Loads and stores less than 128-bits are already atomic; ones above that
|
// Loads and stores less than 128-bits are already atomic; ones above that
|
||||||
|
@ -17823,7 +17823,7 @@ SITargetLowering::shouldExpandAtomicRMWInIR(AtomicRMWInst *RMW) const {
|
|||||||
if (AS == AMDGPUAS::FLAT_ADDRESS &&
|
if (AS == AMDGPUAS::FLAT_ADDRESS &&
|
||||||
DL.getTypeSizeInBits(RMW->getType()) == 64 &&
|
DL.getTypeSizeInBits(RMW->getType()) == 64 &&
|
||||||
flatInstrMayAccessPrivate(RMW))
|
flatInstrMayAccessPrivate(RMW))
|
||||||
return AtomicExpansionKind::Expand;
|
return AtomicExpansionKind::CustomExpand;
|
||||||
|
|
||||||
auto ReportUnsafeHWInst = [=](TargetLowering::AtomicExpansionKind Kind) {
|
auto ReportUnsafeHWInst = [=](TargetLowering::AtomicExpansionKind Kind) {
|
||||||
OptimizationRemarkEmitter ORE(RMW->getFunction());
|
OptimizationRemarkEmitter ORE(RMW->getFunction());
|
||||||
@ -17898,7 +17898,7 @@ SITargetLowering::shouldExpandAtomicRMWInIR(AtomicRMWInst *RMW) const {
|
|||||||
// does. InstCombine transforms these with 0 to or, so undo that.
|
// does. InstCombine transforms these with 0 to or, so undo that.
|
||||||
if (Constant *ConstVal = dyn_cast<Constant>(RMW->getValOperand());
|
if (Constant *ConstVal = dyn_cast<Constant>(RMW->getValOperand());
|
||||||
ConstVal && ConstVal->isNullValue())
|
ConstVal && ConstVal->isNullValue())
|
||||||
return AtomicExpansionKind::Expand;
|
return AtomicExpansionKind::CustomExpand;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the allocation could be in remote, fine-grained memory, the rmw
|
// If the allocation could be in remote, fine-grained memory, the rmw
|
||||||
@ -18027,9 +18027,9 @@ SITargetLowering::shouldExpandAtomicRMWInIR(AtomicRMWInst *RMW) const {
|
|||||||
// fadd.
|
// fadd.
|
||||||
if (Subtarget->hasLDSFPAtomicAddF32()) {
|
if (Subtarget->hasLDSFPAtomicAddF32()) {
|
||||||
if (RMW->use_empty() && Subtarget->hasAtomicFaddNoRtnInsts())
|
if (RMW->use_empty() && Subtarget->hasAtomicFaddNoRtnInsts())
|
||||||
return AtomicExpansionKind::Expand;
|
return AtomicExpansionKind::CustomExpand;
|
||||||
if (!RMW->use_empty() && Subtarget->hasAtomicFaddRtnInsts())
|
if (!RMW->use_empty() && Subtarget->hasAtomicFaddRtnInsts())
|
||||||
return AtomicExpansionKind::Expand;
|
return AtomicExpansionKind::CustomExpand;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -18109,7 +18109,7 @@ SITargetLowering::shouldExpandAtomicCmpXchgInIR(AtomicCmpXchgInst *CmpX) const {
|
|||||||
|
|
||||||
// If a 64-bit flat atomic may alias private, we need to avoid using the
|
// If a 64-bit flat atomic may alias private, we need to avoid using the
|
||||||
// atomic in the private case.
|
// atomic in the private case.
|
||||||
return DL.getTypeSizeInBits(ValTy) == 64 ? AtomicExpansionKind::Expand
|
return DL.getTypeSizeInBits(ValTy) == 64 ? AtomicExpansionKind::CustomExpand
|
||||||
: AtomicExpansionKind::None;
|
: AtomicExpansionKind::None;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21236,7 +21236,7 @@ ARMTargetLowering::shouldExpandAtomicStoreInIR(StoreInst *SI) const {
|
|||||||
has64BitAtomicStore = Subtarget->hasV6Ops();
|
has64BitAtomicStore = Subtarget->hasV6Ops();
|
||||||
|
|
||||||
unsigned Size = SI->getValueOperand()->getType()->getPrimitiveSizeInBits();
|
unsigned Size = SI->getValueOperand()->getType()->getPrimitiveSizeInBits();
|
||||||
return Size == 64 && has64BitAtomicStore ? AtomicExpansionKind::XChg
|
return Size == 64 && has64BitAtomicStore ? AtomicExpansionKind::Expand
|
||||||
: AtomicExpansionKind::None;
|
: AtomicExpansionKind::None;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3938,7 +3938,7 @@ TargetLowering::AtomicExpansionKind
|
|||||||
HexagonTargetLowering::shouldExpandAtomicStoreInIR(StoreInst *SI) const {
|
HexagonTargetLowering::shouldExpandAtomicStoreInIR(StoreInst *SI) const {
|
||||||
// Do not expand loads and stores that don't exceed 64 bits.
|
// Do not expand loads and stores that don't exceed 64 bits.
|
||||||
return SI->getValueOperand()->getType()->getPrimitiveSizeInBits() > 64
|
return SI->getValueOperand()->getType()->getPrimitiveSizeInBits() > 64
|
||||||
? AtomicExpansionKind::XChg
|
? AtomicExpansionKind::Expand
|
||||||
: AtomicExpansionKind::None;
|
: AtomicExpansionKind::None;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7893,7 +7893,7 @@ LoongArchTargetLowering::shouldExpandAtomicRMWInIR(AtomicRMWInst *AI) const {
|
|||||||
if (Size < 32 && (AI->getOperation() == AtomicRMWInst::And ||
|
if (Size < 32 && (AI->getOperation() == AtomicRMWInst::And ||
|
||||||
AI->getOperation() == AtomicRMWInst::Or ||
|
AI->getOperation() == AtomicRMWInst::Or ||
|
||||||
AI->getOperation() == AtomicRMWInst::Xor))
|
AI->getOperation() == AtomicRMWInst::Xor))
|
||||||
return AtomicExpansionKind::Expand;
|
return AtomicExpansionKind::CustomExpand;
|
||||||
if (AI->getOperation() == AtomicRMWInst::Nand || Size < 32)
|
if (AI->getOperation() == AtomicRMWInst::Nand || Size < 32)
|
||||||
return AtomicExpansionKind::CmpXChg;
|
return AtomicExpansionKind::CmpXChg;
|
||||||
}
|
}
|
||||||
|
@ -31723,7 +31723,7 @@ X86TargetLowering::shouldExpandAtomicStoreInIR(StoreInst *SI) const {
|
|||||||
return AtomicExpansionKind::None;
|
return AtomicExpansionKind::None;
|
||||||
}
|
}
|
||||||
|
|
||||||
return needsCmpXchgNb(MemType) ? AtomicExpansionKind::XChg
|
return needsCmpXchgNb(MemType) ? AtomicExpansionKind::Expand
|
||||||
: AtomicExpansionKind::None;
|
: AtomicExpansionKind::None;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user