[clang] [llvm] CodeGen: Replace TargetOptions::ThreadModel with module flag (PR #223157)
Yonah Goldberg via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 14 13:59:10 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())
----------------
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
More information about the cfe-commits
mailing list