================
----------------
dingcyrus wrote:
> Please also add OGCG checks to make sure LLVMIR generated through CIR is
> aligned with the LLVMIR generated through clang CodeGen. See other CIR
> codegen test files for examples.
Thanks for the review! All comments addressed:
1. Unsuffixed __sync_* cases (the two comments on __sync_val_compare_and_swap
/ __sync_bool_compare_and_swap): right — Sema rewrites the unsuffixed forms
before CodeGen, and the previous code also had an incorrect fallthrough (the
unsuffixed __sync_fetch_and_* / __sync_*_and_fetch labels would land in the
cmpxchg handler).
I've grouped all unsuffixed cases into a single llvm_unreachable("Shouldn't
make it through sema"), matching OGCG.
2. Merged emitAtomicCmpXchgBool into emitAtomicCmpXchgValue: done — now a
single emitAtomicCmpXchg(cgf, e, /*returnBool=*/...), mirroring OGCG's
MakeAtomicCmpXchgValue.
3. emitAtomicXchg returning mlir::Value: changed to return RValue for
consistency with the other helpers.
4. __sync_lock_test_and_set ordering: good catch — OGCG lowers it through
EmitBinaryAtomic (i.e. SequentiallyConsistent), so I changed acquire → seq_cst
to match.
5. Test coverage / OGCG checks: rewrote builtin-sync.cpp to cover every size
variant (_1/_2/_4/_8) of all five builtins, and added OGCG -emit-llvm checks so
the LLVM IR emitted through CIR is verified against clang's regular CodeGen.
Verified locally with a full clang build (CIR enabled); builtin-sync.cpp and
the existing atomic.c both pass.
https://github.com/llvm/llvm-project/pull/214606
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits