summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDawid Jurczak <dawid_jurek@vp.pl>2021-08-05 13:01:07 +0200
committerDawid Jurczak <dawid_jurek@vp.pl>2021-08-05 16:18:38 +0200
commit06206a8cd1b1538e265f79e245c34180c640e334 (patch)
treeb0936165ba4b1a8cc72749baeb9c2db79ec442c7
parent95800da914938129083df2fa0165c1901909c273 (diff)
downloadllvm-06206a8cd1b1538e265f79e245c34180c640e334.tar.gz
[BuildLibCalls][NFC] Remove redundant attribute list from emitCalloc
Additionally with this patch aligned DSE which is the only user of emitCalloc. Differential Revision: https://reviews.llvm.org/D103523
-rw-r--r--llvm/include/llvm/Transforms/Utils/BuildLibCalls.h4
-rw-r--r--llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp7
-rw-r--r--llvm/lib/Transforms/Utils/BuildLibCalls.cpp8
3 files changed, 9 insertions, 10 deletions
diff --git a/llvm/include/llvm/Transforms/Utils/BuildLibCalls.h b/llvm/include/llvm/Transforms/Utils/BuildLibCalls.h
index e7d41933a6c9..d6d043aee3fb 100644
--- a/llvm/include/llvm/Transforms/Utils/BuildLibCalls.h
+++ b/llvm/include/llvm/Transforms/Utils/BuildLibCalls.h
@@ -205,8 +205,8 @@ namespace llvm {
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
diff --git a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp b/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
index cd0824ab33b7..b315ecf63c96 100644
--- a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
+++ b/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
@@ -1856,10 +1856,9 @@ struct DSEState {
memoryIsNotModifiedBetween(Malloc, MemSet, BatchAA, DL, &DT)) {
IRBuilder<> IRB(Malloc);
const auto &DL = Malloc->getModule()->getDataLayout();
- AttributeList EmptyList;
- if (auto *Calloc = emitCalloc(
- ConstantInt::get(IRB.getIntPtrTy(DL), 1),
- Malloc->getArgOperand(0), EmptyList, IRB, TLI)) {
+ if (auto *Calloc =
+ emitCalloc(ConstantInt::get(IRB.getIntPtrTy(DL), 1),
+ Malloc->getArgOperand(0), IRB, TLI)) {
MemorySSAUpdater Updater(&MSSA);
auto *LastDef = cast<MemoryDef>(
Updater.getMemorySSA()->getMemoryAccess(Malloc));
diff --git a/llvm/lib/Transforms/Utils/BuildLibCalls.cpp b/llvm/lib/Transforms/Utils/BuildLibCalls.cpp
index 35e22f7a57e2..c42eee7aeddc 100644
--- a/llvm/lib/Transforms/Utils/BuildLibCalls.cpp
+++ b/llvm/lib/Transforms/Utils/BuildLibCalls.cpp
@@ -1655,8 +1655,8 @@ Value *llvm::emitMalloc(Value *Num, IRBuilderBase &B, const DataLayout &DL,
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 @@ Value *llvm::emitCalloc(Value *Num, Value *Size, const AttributeList &Attrs,
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);