[llvm] [LLVM] Add a C API for creating instructions with custom syncscopes. (PR #104775)
Tim Besard via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 19 07:26:55 PDT 2024
================
@@ -4336,25 +4386,29 @@ int LLVMGetMaskValue(LLVMValueRef SVInst, unsigned Elt) {
int LLVMGetUndefMaskElem(void) { return PoisonMaskElem; }
-LLVMBool LLVMIsAtomicSingleThread(LLVMValueRef AtomicInst) {
- Value *P = unwrap(AtomicInst);
-
+static unsigned getAtomicSyncScopeID(Value *P) {
if (AtomicRMWInst *I = dyn_cast<AtomicRMWInst>(P))
- return I->getSyncScopeID() == SyncScope::SingleThread;
+ return I->getSyncScopeID();
else if (FenceInst *FI = dyn_cast<FenceInst>(P))
- return FI->getSyncScopeID() == SyncScope::SingleThread;
+ return FI->getSyncScopeID();
else if (StoreInst *SI = dyn_cast<StoreInst>(P))
- return SI->getSyncScopeID() == SyncScope::SingleThread;
+ return SI->getSyncScopeID();
else if (LoadInst *LI = dyn_cast<LoadInst>(P))
- return LI->getSyncScopeID() == SyncScope::SingleThread;
- return cast<AtomicCmpXchgInst>(P)->getSyncScopeID() ==
- SyncScope::SingleThread;
+ return LI->getSyncScopeID();
+ return cast<AtomicCmpXchgInst>(P)->getSyncScopeID();
----------------
maleadt wrote:
Ah yes. Do I add a similar `setAtomicSyncScopeID` helper then too?
https://github.com/llvm/llvm-project/pull/104775
More information about the llvm-commits
mailing list