[llvm] [llvm][opt][Transforms] Replacement `calloc` should match replaced `malloc` (PR #110524)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 30 08:57:20 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 fb6feb86a7dc324dcb2516397ba3fc5fe05ea584 93af908d053432bfa2ba81feedc7e6cfc094902a --extensions cpp,h -- llvm/include/llvm/Transforms/Utils/BuildLibCalls.h llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp llvm/lib/Transforms/Utils/BuildLibCalls.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp b/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
index 39c3d76974..ce8c988ba5 100644
--- a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
+++ b/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
@@ -1944,9 +1944,9 @@ struct DSEState {
return false;
IRBuilder<> IRB(Malloc);
Type *SizeTTy = Malloc->getArgOperand(0)->getType();
- auto *Calloc = emitCalloc(ConstantInt::get(SizeTTy, 1),
- Malloc->getArgOperand(0), IRB, TLI,
- Malloc->getType()->getPointerAddressSpace());
+ auto *Calloc =
+ emitCalloc(ConstantInt::get(SizeTTy, 1), Malloc->getArgOperand(0), IRB,
+ TLI, Malloc->getType()->getPointerAddressSpace());
if (!Calloc)
return false;
diff --git a/llvm/lib/Transforms/Utils/BuildLibCalls.cpp b/llvm/lib/Transforms/Utils/BuildLibCalls.cpp
index 06d0d6bab2..7bb4b55fcb 100644
--- a/llvm/lib/Transforms/Utils/BuildLibCalls.cpp
+++ b/llvm/lib/Transforms/Utils/BuildLibCalls.cpp
@@ -1985,9 +1985,8 @@ Value *llvm::emitCalloc(Value *Num, Value *Size, IRBuilderBase &B,
StringRef CallocName = TLI.getName(LibFunc_calloc);
Type *SizeTTy = getSizeTTy(B, &TLI);
- FunctionCallee Calloc = getOrInsertLibFunc(M, TLI, LibFunc_calloc,
- B.getPtrTy(AddrSpace), SizeTTy,
- SizeTTy);
+ FunctionCallee Calloc = getOrInsertLibFunc(
+ M, TLI, LibFunc_calloc, B.getPtrTy(AddrSpace), SizeTTy, SizeTTy);
inferNonMandatoryLibFuncAttrs(M, CallocName, TLI);
CallInst *CI = B.CreateCall(Calloc, {Num, Size}, CallocName);
``````````
</details>
https://github.com/llvm/llvm-project/pull/110524
More information about the llvm-commits
mailing list