[all-commits] [llvm/llvm-project] 550f61: [SimplifyCFG] Preserve atomicity when merging atom...
Justin Lebar via All-commits
all-commits at lists.llvm.org
Fri May 29 11:46:56 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 550f61f191e57660ce9a55da22304b736ff85606
https://github.com/llvm/llvm-project/commit/550f61f191e57660ce9a55da22304b736ff85606
Author: Justin Lebar <justin.lebar at gmail.com>
Date: 2026-05-29 (Fri, 29 May 2026)
Changed paths:
M llvm/lib/Transforms/Utils/SimplifyCFG.cpp
M llvm/test/Transforms/SimplifyCFG/merge-cond-stores.ll
Log Message:
-----------
[SimplifyCFG] Preserve atomicity when merging atomic conditional stores (#200327)
mergeConditionalStoreToAddress() merges two stores into one. It does
this for non-atomic and atomic-unordered stores, but when merging
unordered stores, it would downgrade them to non-atomic!
This bug isn't accessible from C because C doesn't expose unordered
atomics. But you can access it from e.g. Objective-C with something like
```
// repro.m — clang -fno-objc-arc -O2
__attribute__((objc_root_class))
@interface C { int _value; }
@property(atomic, direct) int value;
@end
@implementation C
@end
void f(C *obj, _Bool c1, _Bool c2, int v1, int v2) {
if (!obj) __builtin_unreachable();
if (c1) obj.value = v1;
if (c2) obj.value = v2;
}
```
LLVM merges these into a single store. The store is non-atomic without
this change.
This bug was found by a large run of Opus 4.7 looking for bugs in LLVM.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply at anthropic.com>
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list