You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The llvm version in the latest builds of Swift 5.5 generates broken code for double-wide atomic loads on arm64 when compiled without optimizations, indefinitely pegging the CPU at 100% the first time such an operation is executed.
Information
Package version: 1.0.1
Platform version: macOS 12 beta
Swift version: Swift 5.5 (swiftlang-1300.0.29.102 clang-1300.0.28.1) from Xcode 13 beta 5
Checklist
If possible, I've reproduced the issue using the main branch of this package.
Run the tests on an arm64 machine with optimizations disabled.
$ swift --version
swift-driver version: 1.26.9 Apple Swift version 5.5 (swiftlang-1300.0.29.102 clang-1300.0.28.1)
Target: arm64-apple-macosx11.0
$ swift test
Expected behavior
The tests finish successfully.
Actual behavior
...
Test Suite 'BasicAtomicDoubleWordTests' started at 2021-09-10 19:53:24.309
Test Case '-[AtomicsTests.BasicAtomicDoubleWordTests test_compareExchange_acquiring]' started.
(never finishes)
For the Swift 5.5 toolchain, we can work around this issue by switching to loading double-wide atomics using compare-exchange in debug builds on arm64.
lorentey
added a commit
to lorentey/swift-atomics
that referenced
this issue
Sep 22, 2021
The llvm version in the latest builds of Swift 5.5 generates broken code for double-wide atomic loads on arm64 when compiled without optimizations, indefinitely pegging the CPU at 100% the first time such an operation is executed.
Information
Checklist
main
branch of this package.Steps to Reproduce
Run the tests on an arm64 machine with optimizations disabled.
Expected behavior
The tests finish successfully.
Actual behavior
The issue boils down to bad codegen:
Note the extra
str
to stack in the middle of the ldaxp/stlxp transaction; IIUC, this makes stlxp fail unconditionally.The text was updated successfully, but these errors were encountered: