[clang] [llvm] Add emitAtomicCompareExchangeBuiltin helper function (PR #101966)

via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 5 10:14:06 PDT 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 04f65043bc8711996a4ade05c67ae2d087ae8be5 ee84c6bb3146d25f21c14d6d8e0abb794683f5ec --extensions h,c,cpp -- llvm/include/llvm/Transforms/Utils/BuildBuiltins.h llvm/lib/Transforms/Utils/BuildBuiltins.cpp clang/include/clang/CodeGen/BackendUtil.h clang/include/clang/CodeGen/ModuleBuilder.h clang/include/clang/Frontend/CompilerInstance.h clang/lib/CodeGen/BackendConsumer.h clang/lib/CodeGen/BackendUtil.cpp clang/lib/CodeGen/CGAtomic.cpp clang/lib/CodeGen/CodeGenAction.cpp clang/lib/CodeGen/CodeGenFunction.cpp clang/lib/CodeGen/CodeGenFunction.h clang/lib/CodeGen/CodeGenModule.cpp clang/lib/CodeGen/CodeGenModule.h clang/lib/CodeGen/ModuleBuilder.cpp clang/lib/CodeGen/ObjectFilePCHContainerWriter.cpp clang/lib/Frontend/CompilerInstance.cpp clang/test/CodeGen/PowerPC/builtins-ppc-xlcompat-cas.c clang/test/CodeGen/PowerPC/quadword-atomics.c clang/test/CodeGen/SystemZ/gnu-atomic-builtins-i128-16Al.c clang/test/CodeGen/SystemZ/gnu-atomic-builtins-i128-8Al.c clang/test/CodeGen/SystemZ/gnu-atomic-builtins-i16.c clang/test/CodeGen/SystemZ/gnu-atomic-builtins-i32.c clang/test/CodeGen/SystemZ/gnu-atomic-builtins-i64.c clang/test/CodeGen/SystemZ/gnu-atomic-builtins-i8.c clang/test/CodeGen/X86/x86-atomic-long_double.c clang/test/CodeGen/atomic-ops.c clang/test/CodeGen/atomic_ops.c clang/test/CodeGen/c11atomics-ios.c clang/test/CodeGen/c11atomics.c clang/test/CodeGen/sanitize-atomic-int-overflow.c clang/test/CodeGen/stack-arg-probe.c clang/test/CodeGenCXX/atomic-inline.cpp llvm/include/llvm/MC/TargetRegistry.h llvm/include/llvm/Support/AtomicOrdering.h llvm/include/llvm/Target/TargetMachine.h llvm/include/llvm/Transforms/Utils/BuildLibCalls.h llvm/lib/Analysis/TargetLibraryInfo.cpp llvm/lib/CodeGen/AtomicExpandPass.cpp llvm/lib/CodeGen/LLVMTargetMachine.cpp llvm/lib/MC/TargetRegistry.cpp llvm/lib/Target/PowerPC/PPCTargetMachine.cpp llvm/lib/Transforms/Utils/BuildLibCalls.cpp llvm/unittests/Analysis/TargetLibraryInfoTest.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/lib/Analysis/TargetLibraryInfo.cpp b/llvm/lib/Analysis/TargetLibraryInfo.cpp
index e907be02ad..ed2d00af99 100644
--- a/llvm/lib/Analysis/TargetLibraryInfo.cpp
+++ b/llvm/lib/Analysis/TargetLibraryInfo.cpp
@@ -68,9 +68,9 @@ enum FuncArgTypeID : char {
   Long,    // Either 32 or 64 bits.
   IntX,    // Any integer type.
   Int64,
-  LLong,    // 64 bits on all targets.
-  SizeT,    // size_t.
-  SSizeT,   // POSIX ssize_t.
+  LLong,  // 64 bits on all targets.
+  SizeT,  // size_t.
+  SSizeT, // POSIX ssize_t.
   Int128,
   Flt,      // IEEE float.
   Dbl,      // IEEE double.
diff --git a/llvm/lib/Transforms/Utils/BuildBuiltins.cpp b/llvm/lib/Transforms/Utils/BuildBuiltins.cpp
index 245fc39818..37eac16aef 100644
--- a/llvm/lib/Transforms/Utils/BuildBuiltins.cpp
+++ b/llvm/lib/Transforms/Utils/BuildBuiltins.cpp
@@ -558,7 +558,7 @@ Value *llvm::emitAtomicCompareExchangeBuiltin(
   // this should not happen.
   // It may also fail if the target's TargetLibraryInfo claims that
   // __atomic_compare_exchange is not supported. In either case there is no
-  // fallback for atomics not supported by the target and we have to crash. 
+  // fallback for atomics not supported by the target and we have to crash.
   Value *SuccessResult = emitAtomicCompareExchange(
       ConstantInt::get(getSizeTTy(Builder, TLI), DataSizeConst), Ptr,
       ExpectedPtr, DesiredPtr, SuccessMemorderCABI, FailureMemorderCABI,

``````````

</details>


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


More information about the cfe-commits mailing list