[PATCH] D103523: [BuildLibCalls][NFC] Remove redundant attribute list from emitCalloc

Dawid Jurczak via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 2 06:46:56 PDT 2021


yurai007 created this revision.
yurai007 added reviewers: xbolva00, nikic, fhahn, asbirlea, hubert.reinterpretcast.
Herald added a subscriber: hiraditya.
yurai007 requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Additionally with this change aligned DSE which is the only user of emitCalloc.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D103523

Files:
  llvm/include/llvm/Transforms/Utils/BuildLibCalls.h
  llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
  llvm/lib/Transforms/Utils/BuildLibCalls.cpp


Index: llvm/lib/Transforms/Utils/BuildLibCalls.cpp
===================================================================
--- llvm/lib/Transforms/Utils/BuildLibCalls.cpp
+++ llvm/lib/Transforms/Utils/BuildLibCalls.cpp
@@ -1655,8 +1655,8 @@
   return CI;
 }
 
-Value *llvm::emitCalloc(Value *Num, Value *Size, const AttributeList &Attrs,
-                        IRBuilderBase &B, const TargetLibraryInfo &TLI) {
+Value *llvm::emitCalloc(Value *Num, Value *Size, IRBuilderBase &B,
+                        const TargetLibraryInfo &TLI) {
   if (!TLI.has(LibFunc_calloc))
     return nullptr;
 
@@ -1664,8 +1664,8 @@
   StringRef CallocName = TLI.getName(LibFunc_calloc);
   const DataLayout &DL = M->getDataLayout();
   IntegerType *PtrType = DL.getIntPtrType((B.GetInsertBlock()->getContext()));
-  FunctionCallee Calloc = M->getOrInsertFunction(
-      CallocName, Attrs, B.getInt8PtrTy(), PtrType, PtrType);
+  FunctionCallee Calloc =
+      M->getOrInsertFunction(CallocName, B.getInt8PtrTy(), PtrType, PtrType);
   inferLibFuncAttributes(M, CallocName, TLI);
   CallInst *CI = B.CreateCall(Calloc, {Num, Size}, CallocName);
 
Index: llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
+++ llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
@@ -1847,10 +1847,9 @@
               const auto &DL = Malloc->getModule()->getDataLayout();
               auto *SizeType =
                   DL.getIntPtrType(IRB.GetInsertBlock()->getContext());
-              AttributeList EmptyList;
-              if (auto *Calloc = emitCalloc(ConstantInt::get(SizeType, 1),
-                                            Malloc->getArgOperand(0), EmptyList,
-                                            IRB, TLI)) {
+              if (auto *Calloc =
+                      emitCalloc(ConstantInt::get(SizeType, 1),
+                                 Malloc->getArgOperand(0), IRB, TLI)) {
                 Malloc->replaceAllUsesWith(Calloc);
                 Malloc->eraseFromParent();
                 return true;
Index: llvm/include/llvm/Transforms/Utils/BuildLibCalls.h
===================================================================
--- llvm/include/llvm/Transforms/Utils/BuildLibCalls.h
+++ llvm/include/llvm/Transforms/Utils/BuildLibCalls.h
@@ -205,8 +205,8 @@
                     const TargetLibraryInfo *TLI);
 
   /// Emit a call to the calloc function.
-  Value *emitCalloc(Value *Num, Value *Size, const AttributeList &Attrs,
-                    IRBuilderBase &B, const TargetLibraryInfo &TLI);
+  Value *emitCalloc(Value *Num, Value *Size, IRBuilderBase &B,
+                    const TargetLibraryInfo &TLI);
 }
 
 #endif


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D103523.349255.patch
Type: text/x-patch
Size: 2745 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210602/8fe778cf/attachment.bin>


More information about the llvm-commits mailing list