[clang] [llvm] CodeGen: Replace TargetOptions::ThreadModel with module flag (PR #223157)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 15 01:57:17 PDT 2026
================
@@ -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
More information about the llvm-commits
mailing list