[all-commits] [llvm/llvm-project] 2f497e: [ARM] Fix ARM backend to correctly use atomic expa...
Eli Friedman via All-commits
all-commits at lists.llvm.org
Fri Mar 18 12:44:14 PDT 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 2f497ec3a0056f15727ee6008211aeb2c4a8f455
https://github.com/llvm/llvm-project/commit/2f497ec3a0056f15727ee6008211aeb2c4a8f455
Author: Eli Friedman <efriedma at quicinc.com>
Date: 2022-03-18 (Fri, 18 Mar 2022)
Changed paths:
M llvm/lib/Target/ARM/ARMISelLowering.cpp
M llvm/lib/Target/ARM/ARMSubtarget.cpp
M llvm/lib/Target/ARM/ARMSubtarget.h
M llvm/test/CodeGen/ARM/atomic-64bit.ll
M llvm/test/CodeGen/ARM/atomic-load-store.ll
M llvm/test/CodeGen/ARM/atomic-op.ll
M llvm/test/CodeGen/ARM/atomic-ops-m33.ll
M llvm/test/CodeGen/ARM/atomicrmw_exclusive_monitor_ints.ll
Log Message:
-----------
[ARM] Fix ARM backend to correctly use atomic expansion routines.
Without this patch, clang would generate calls to __sync_* routines on
targets where it does not make sense; we can't assume the routines exist
on unknown targets. Linux has special implementations of the routines
that work on old ARM targets; other targets have no such routines. In
general, atomics operations which aren't natively supported should go
through libatomic (__atomic_*) APIs, which can support arbitrary atomics
through locks.
ARM targets older than v6, where this patch makes a difference, are rare
in practice, but not completely extinct. See, for example, discussion on
D116088.
This also affects Cortex-M0, but I don't think __sync_* routines
actually exist in any Cortex-M0 libraries. So in practice this just
leads to a slightly different linker error for those cases, I think.
Mechanically, this patch does the following:
- Ensures we run atomic expansion unconditionally; it never makes sense to
completely skip it.
- Fixes getMaxAtomicSizeInBitsSupported() so it returns an appropriate
number on all ARM subtargets.
- Fixes shouldExpandAtomicRMWInIR() and shouldExpandAtomicCmpXchgInIR() to
correctly handle subtargets that don't have atomic instructions.
Differential Revision: https://reviews.llvm.org/D120026
More information about the All-commits
mailing list