================
@@ -457,8 +500,11 @@ bool AtomicExpandImpl::processAtomicInstr(Instruction *I) {
bool AtomicExpandImpl::run(Function &F,
const ModuleLibcallLoweringInfo &LibcallResult,
const TargetMachine *TM) {
+ SingleThreaded = F.getParent()->getThreadModel() == ThreadModel::Single;
+
const auto *Subtarget = TM->getSubtargetImpl(F);
- if (!Subtarget->enableAtomicExpand())
+ // In a single-threaded environment atomics are lowered to non-atomic form
+ if (!SingleThreaded && !Subtarget->enableAtomicExpand())
----------------
YonahGoldberg wrote:
If we're making lowering atomic -> not atomic part of AtomicExpand it's a
little weird to selectively enable it even when the pass is disabled. ARM
doesn't ever disable atomic expand so I'm not sure if we need this.
https://github.com/llvm/llvm-project/pull/223157
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits