[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
Tue Aug 20 01:53:43 PDT 2024


================
@@ -754,7 +755,13 @@ struct FunCloner {
         LLVMSetAlignment(Dst, LLVMGetAlignment(Src));
         LLVMSetOrdering(Dst, LLVMGetOrdering(Src));
         LLVMSetVolatile(Dst, LLVMGetVolatile(Src));
-        LLVMSetAtomicSingleThread(Dst, LLVMIsAtomicSingleThread(Src));
+        if (LLVMIsAtomic(Src)) {
+          LLVMBool IsAtomicSingleThread = LLVMIsAtomicSingleThread(Src);
+          if (IsAtomicSingleThread)
+            LLVMSetAtomicSingleThread(Dst, IsAtomicSingleThread);
+          else
+            LLVMSetAtomicSyncScopeID(Dst, LLVMGetAtomicSyncScopeID(Src));
----------------
maleadt wrote:

Yeah, the intention was test coverage. I'll move it to a unit test.

https://github.com/llvm/llvm-project/pull/104775


More information about the llvm-commits mailing list