================
@@ -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())
----------------
arsenm wrote:

IMO we should just delete enableAtomicExpand, and add it to the default 
pipeline. We have the worst of both worlds where targets need to both implement 
enableAtomicExpand, and add it to the pass config 

https://github.com/llvm/llvm-project/pull/223157
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to