[all-commits] [llvm/llvm-project] d222c5: [C API] Fix LLVMGetOrdering/LLVMIsAtomicSingleThre...
Benji Smith via All-commits
all-commits at lists.llvm.org
Sat Sep 30 07:52:44 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: d222c5ec47a09a3e120000e4a1006f4da7741256
https://github.com/llvm/llvm-project/commit/d222c5ec47a09a3e120000e4a1006f4da7741256
Author: Benji Smith <6193112+Benjins at users.noreply.github.com>
Date: 2023-09-30 (Sat, 30 Sep 2023)
Changed paths:
M llvm/lib/IR/Core.cpp
M llvm/test/Bindings/llvm-c/atomics.ll
M llvm/tools/llvm-c-test/echo.cpp
Log Message:
-----------
[C API] Fix LLVMGetOrdering/LLVMIsAtomicSingleThread for fence/memory instrs (#65228)
Fixes https://github.com/llvm/llvm-project/issues/65227
LLVMGetOrdering previously did not support Fence instructions, and
calling it on a fence would lead to a bad cast as it
assumed a load/store, or an AtomicRMWInst. This would either read a
garbage memory order, or assertion
LLVMIsAtomicSingleThread did not support either Fence instructions,
loads, or stores, and would similarly lead to a bad cast.
It happened to work out since the relevant types all have their synch
scope ID at the same offset, but it still should be fixed
These cases are now fixed for the C API, and tests for these
instructions are added. The echo test utility now also supports cloning
Fence instructions, which it did not previously
-----
>From what I can tell, there's no unified API to pull
`getOrdering`/`getSyncScopeID` from, and instead requires casting to
individual types: if there is a better way of handling this I can switch
to that
More information about the All-commits
mailing list