Skip to content

Commit 06206a8

Browse files
committed
[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
1 parent 95800da commit 06206a8

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

llvm/include/llvm/Transforms/Utils/BuildLibCalls.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,8 @@ namespace llvm {
205205
const TargetLibraryInfo *TLI);
206206

207207
/// Emit a call to the calloc function.
208-
Value *emitCalloc(Value *Num, Value *Size, const AttributeList &Attrs,
209-
IRBuilderBase &B, const TargetLibraryInfo &TLI);
208+
Value *emitCalloc(Value *Num, Value *Size, IRBuilderBase &B,
209+
const TargetLibraryInfo &TLI);
210210
}
211211

212212
#endif

llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1856,10 +1856,9 @@ struct DSEState {
18561856
memoryIsNotModifiedBetween(Malloc, MemSet, BatchAA, DL, &DT)) {
18571857
IRBuilder<> IRB(Malloc);
18581858
const auto &DL = Malloc->getModule()->getDataLayout();
1859-
AttributeList EmptyList;
1860-
if (auto *Calloc = emitCalloc(
1861-
ConstantInt::get(IRB.getIntPtrTy(DL), 1),
1862-
Malloc->getArgOperand(0), EmptyList, IRB, TLI)) {
1859+
if (auto *Calloc =
1860+
emitCalloc(ConstantInt::get(IRB.getIntPtrTy(DL), 1),
1861+
Malloc->getArgOperand(0), IRB, TLI)) {
18631862
MemorySSAUpdater Updater(&MSSA);
18641863
auto *LastDef = cast<MemoryDef>(
18651864
Updater.getMemorySSA()->getMemoryAccess(Malloc));

llvm/lib/Transforms/Utils/BuildLibCalls.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1655,17 +1655,17 @@ Value *llvm::emitMalloc(Value *Num, IRBuilderBase &B, const DataLayout &DL,
16551655
return CI;
16561656
}
16571657

1658-
Value *llvm::emitCalloc(Value *Num, Value *Size, const AttributeList &Attrs,
1659-
IRBuilderBase &B, const TargetLibraryInfo &TLI) {
1658+
Value *llvm::emitCalloc(Value *Num, Value *Size, IRBuilderBase &B,
1659+
const TargetLibraryInfo &TLI) {
16601660
if (!TLI.has(LibFunc_calloc))
16611661
return nullptr;
16621662

16631663
Module *M = B.GetInsertBlock()->getModule();
16641664
StringRef CallocName = TLI.getName(LibFunc_calloc);
16651665
const DataLayout &DL = M->getDataLayout();
16661666
IntegerType *PtrType = DL.getIntPtrType((B.GetInsertBlock()->getContext()));
1667-
FunctionCallee Calloc = M->getOrInsertFunction(
1668-
CallocName, Attrs, B.getInt8PtrTy(), PtrType, PtrType);
1667+
FunctionCallee Calloc =
1668+
M->getOrInsertFunction(CallocName, B.getInt8PtrTy(), PtrType, PtrType);
16691669
inferLibFuncAttributes(M, CallocName, TLI);
16701670
CallInst *CI = B.CreateCall(Calloc, {Num, Size}, CallocName);
16711671

0 commit comments

Comments
 (0)