[PATCH] add default value for Args parameter of IRBuilder.CreateCall
servuswiegehtz at yahoo.de
servuswiegehtz at yahoo.de
Sun Jun 14 13:21:21 PDT 2015
From: Pete Abred <servuswiegehtz at yahoo.de>
Default parameter allows for easier usage for functions without
parameters, e.g.: Builder.CreateCall(abort).
Adapt users of IRBuilder.CreateCall function with no parameters.
---
include/llvm/IR/IRBuilder.h | 2 +-
lib/CodeGen/StackProtector.cpp | 2 +-
lib/Target/PowerPC/PPCCTRLoops.cpp | 2 +-
lib/Target/PowerPC/PPCISelLowering.cpp | 2 +-
lib/Target/R600/AMDGPUPromoteAlloca.cpp | 10 +++++-----
lib/Target/X86/X86ISelLowering.cpp | 2 +-
lib/Target/XCore/XCoreLowerThreadLocal.cpp | 2 +-
lib/Transforms/Instrumentation/AddressSanitizer.cpp | 6 +++---
lib/Transforms/Instrumentation/BoundsChecking.cpp | 2 +-
lib/Transforms/Instrumentation/DataFlowSanitizer.cpp | 6 +++---
lib/Transforms/Instrumentation/GCOVProfiling.cpp | 6 +++---
lib/Transforms/Instrumentation/InstrProfiling.cpp | 2 +-
lib/Transforms/Instrumentation/MemorySanitizer.cpp | 8 ++++----
lib/Transforms/Instrumentation/SanitizerCoverage.cpp | 2 +-
lib/Transforms/Instrumentation/ThreadSanitizer.cpp | 2 +-
unittests/ExecutionEngine/MCJIT/MCJITTest.cpp | 2 +-
16 files changed, 29 insertions(+), 29 deletions(-)
diff --git a/include/llvm/IR/IRBuilder.h b/include/llvm/IR/IRBuilder.h
index adf6924..fdf65a3 100644
--- a/include/llvm/IR/IRBuilder.h
+++ b/include/llvm/IR/IRBuilder.h
@@ -1465,7 +1465,7 @@ public:
return Insert(PHINode::Create(Ty, NumReservedValues), Name);
}
- CallInst *CreateCall(Value *Callee, ArrayRef<Value *> Args,
+ CallInst *CreateCall(Value *Callee, ArrayRef<Value *> Args = {},
const Twine &Name = "") {
return Insert(CallInst::Create(Callee, Args), Name);
}
diff --git a/lib/CodeGen/StackProtector.cpp b/lib/CodeGen/StackProtector.cpp
index 0824d6f..09d44c0 100644
--- a/lib/CodeGen/StackProtector.cpp
+++ b/lib/CodeGen/StackProtector.cpp
@@ -488,7 +488,7 @@ BasicBlock *StackProtector::CreateFailBB() {
Constant *StackChkFail =
M->getOrInsertFunction("__stack_chk_fail", Type::getVoidTy(Context),
nullptr);
- B.CreateCall(StackChkFail, {});
+ B.CreateCall(StackChkFail);
}
B.CreateUnreachable();
return FailBB;
diff --git a/lib/Target/PowerPC/PPCCTRLoops.cpp b/lib/Target/PowerPC/PPCCTRLoops.cpp
index 69afd68..c595f44 100644
--- a/lib/Target/PowerPC/PPCCTRLoops.cpp
+++ b/lib/Target/PowerPC/PPCCTRLoops.cpp
@@ -553,7 +553,7 @@ bool PPCCTRLoops::convertToCTRLoop(Loop *L) {
IRBuilder<> CondBuilder(CountedExitBranch);
Value *DecFunc =
Intrinsic::getDeclaration(M, Intrinsic::ppc_is_decremented_ctr_nonzero);
- Value *NewCond = CondBuilder.CreateCall(DecFunc, {});
+ Value *NewCond = CondBuilder.CreateCall(DecFunc);
Value *OldCond = CountedExitBranch->getCondition();
CountedExitBranch->setCondition(NewCond);
diff --git a/lib/Target/PowerPC/PPCISelLowering.cpp b/lib/Target/PowerPC/PPCISelLowering.cpp
index 2600ee5..b98f961 100644
--- a/lib/Target/PowerPC/PPCISelLowering.cpp
+++ b/lib/Target/PowerPC/PPCISelLowering.cpp
@@ -7883,7 +7883,7 @@ void PPCTargetLowering::ReplaceNodeResults(SDNode *N,
static Instruction* callIntrinsic(IRBuilder<> &Builder, Intrinsic::ID Id) {
Module *M = Builder.GetInsertBlock()->getParent()->getParent();
Function *Func = Intrinsic::getDeclaration(M, Id);
- return Builder.CreateCall(Func, {});
+ return Builder.CreateCall(Func);
}
// The mappings for emitLeading/TrailingFence is taken from
diff --git a/lib/Target/R600/AMDGPUPromoteAlloca.cpp b/lib/Target/R600/AMDGPUPromoteAlloca.cpp
index 4a65bfc..062ad88 100644
--- a/lib/Target/R600/AMDGPUPromoteAlloca.cpp
+++ b/lib/Target/R600/AMDGPUPromoteAlloca.cpp
@@ -316,11 +316,11 @@ void AMDGPUPromoteAlloca::visitAlloca(AllocaInst &I) {
Value *ReadTIDIGZ = Mod->getOrInsertFunction(
"llvm.r600.read.tidig.z", FTy, AttrSet);
- Value *TCntY = Builder.CreateCall(ReadLocalSizeY, {});
- Value *TCntZ = Builder.CreateCall(ReadLocalSizeZ, {});
- Value *TIdX = Builder.CreateCall(ReadTIDIGX, {});
- Value *TIdY = Builder.CreateCall(ReadTIDIGY, {});
- Value *TIdZ = Builder.CreateCall(ReadTIDIGZ, {});
+ Value *TCntY = Builder.CreateCall(ReadLocalSizeY);
+ Value *TCntZ = Builder.CreateCall(ReadLocalSizeZ);
+ Value *TIdX = Builder.CreateCall(ReadTIDIGX);
+ Value *TIdY = Builder.CreateCall(ReadTIDIGY);
+ Value *TIdZ = Builder.CreateCall(ReadTIDIGZ);
Value *Tmp0 = Builder.CreateMul(TCntY, TCntZ);
Tmp0 = Builder.CreateMul(Tmp0, TIdX);
diff --git a/lib/Target/X86/X86ISelLowering.cpp b/lib/Target/X86/X86ISelLowering.cpp
index 040779e..e4eb477 100644
--- a/lib/Target/X86/X86ISelLowering.cpp
+++ b/lib/Target/X86/X86ISelLowering.cpp
@@ -17277,7 +17277,7 @@ X86TargetLowering::lowerIdempotentRMWIntoFencedLoad(AtomicRMWInst *AI) const {
Function *MFence =
llvm::Intrinsic::getDeclaration(M, Intrinsic::x86_sse2_mfence);
- Builder.CreateCall(MFence, {});
+ Builder.CreateCall(MFence);
// Finally we can emit the atomic load.
LoadInst *Loaded = Builder.CreateAlignedLoad(Ptr,
diff --git a/lib/Target/XCore/XCoreLowerThreadLocal.cpp b/lib/Target/XCore/XCoreLowerThreadLocal.cpp
index 996c6f5..9fb63e9 100644
--- a/lib/Target/XCore/XCoreLowerThreadLocal.cpp
+++ b/lib/Target/XCore/XCoreLowerThreadLocal.cpp
@@ -209,7 +209,7 @@ bool XCoreLowerThreadLocal::lowerGlobal(GlobalVariable *GV) {
IRBuilder<> Builder(Inst);
Function *GetID = Intrinsic::getDeclaration(GV->getParent(),
Intrinsic::xcore_getid);
- Value *ThreadID = Builder.CreateCall(GetID, {});
+ Value *ThreadID = Builder.CreateCall(GetID);
SmallVector<Value *, 2> Indices;
Indices.push_back(Constant::getNullValue(Type::getInt64Ty(Ctx)));
Indices.push_back(ThreadID);
diff --git a/lib/Transforms/Instrumentation/AddressSanitizer.cpp b/lib/Transforms/Instrumentation/AddressSanitizer.cpp
index 39c1e41..a907a4b 100644
--- a/lib/Transforms/Instrumentation/AddressSanitizer.cpp
+++ b/lib/Transforms/Instrumentation/AddressSanitizer.cpp
@@ -970,7 +970,7 @@ Instruction *AddressSanitizer::generateCrashCode(Instruction *InsertBefore,
// We don't do Call->setDoesNotReturn() because the BB already has
// UnreachableInst at the end.
// This EmptyAsm is required to avoid callback merge.
- IRB.CreateCall(EmptyAsm, {});
+ IRB.CreateCall(EmptyAsm);
return Call;
}
@@ -1448,7 +1448,7 @@ bool AddressSanitizer::maybeInsertAsanInitAtFunctionEntry(Function &F) {
// instrumented functions.
if (F.getName().find(" load]") != std::string::npos) {
IRBuilder<> IRB(F.begin()->begin());
- IRB.CreateCall(AsanInitFunction, {});
+ IRB.CreateCall(AsanInitFunction);
return true;
}
return false;
@@ -1548,7 +1548,7 @@ bool AddressSanitizer::runOnFunction(Function &F) {
// See e.g. http://code.google.com/p/address-sanitizer/issues/detail?id=37
for (auto CI : NoReturnCalls) {
IRBuilder<> IRB(CI);
- IRB.CreateCall(AsanHandleNoReturnFunc, {});
+ IRB.CreateCall(AsanHandleNoReturnFunc);
}
for (auto Inst : PointerComparisonsOrSubtracts) {
diff --git a/lib/Transforms/Instrumentation/BoundsChecking.cpp b/lib/Transforms/Instrumentation/BoundsChecking.cpp
index f685803..8113834 100644
--- a/lib/Transforms/Instrumentation/BoundsChecking.cpp
+++ b/lib/Transforms/Instrumentation/BoundsChecking.cpp
@@ -82,7 +82,7 @@ BasicBlock *BoundsChecking::getTrapBB() {
Builder->SetInsertPoint(TrapBB);
llvm::Value *F = Intrinsic::getDeclaration(Fn->getParent(), Intrinsic::trap);
- CallInst *TrapCall = Builder->CreateCall(F, {});
+ CallInst *TrapCall = Builder->CreateCall(F);
TrapCall->setDoesNotReturn();
TrapCall->setDoesNotThrow();
TrapCall->setDebugLoc(Inst->getDebugLoc());
diff --git a/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp b/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
index 2de6e1a..aaa5eca 100644
--- a/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
+++ b/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
@@ -850,7 +850,7 @@ bool DataFlowSanitizer::runOnModule(Module &M) {
BranchInst *BI = cast<BranchInst>(SplitBlockAndInsertIfThen(
Ne, Pos, /*Unreachable=*/false, ColdCallWeights));
IRBuilder<> ThenIRB(BI);
- ThenIRB.CreateCall(DFSF.DFS.DFSanNonzeroLabelFn, {});
+ ThenIRB.CreateCall(DFSF.DFS.DFSanNonzeroLabelFn);
}
}
}
@@ -865,7 +865,7 @@ Value *DFSanFunction::getArgTLSPtr() {
return ArgTLSPtr = DFS.ArgTLS;
IRBuilder<> IRB(F->getEntryBlock().begin());
- return ArgTLSPtr = IRB.CreateCall(DFS.GetArgTLS, {});
+ return ArgTLSPtr = IRB.CreateCall(DFS.GetArgTLS);
}
Value *DFSanFunction::getRetvalTLS() {
@@ -875,7 +875,7 @@ Value *DFSanFunction::getRetvalTLS() {
return RetvalTLSPtr = DFS.RetvalTLS;
IRBuilder<> IRB(F->getEntryBlock().begin());
- return RetvalTLSPtr = IRB.CreateCall(DFS.GetRetvalTLS, {});
+ return RetvalTLSPtr = IRB.CreateCall(DFS.GetRetvalTLS);
}
Value *DFSanFunction::getArgTLS(unsigned Idx, Instruction *Pos) {
diff --git a/lib/Transforms/Instrumentation/GCOVProfiling.cpp b/lib/Transforms/Instrumentation/GCOVProfiling.cpp
index 9a3ed5c..ddc4c2c 100644
--- a/lib/Transforms/Instrumentation/GCOVProfiling.cpp
+++ b/lib/Transforms/Instrumentation/GCOVProfiling.cpp
@@ -873,8 +873,8 @@ Function *GCOVProfiler::insertCounterWriteout(
Builder.CreateCall(EmitArcs, {Builder.getInt32(Arcs),
Builder.CreateConstGEP2_64(GV, 0, 0)});
}
- Builder.CreateCall(SummaryInfo, {});
- Builder.CreateCall(EndFile, {});
+ Builder.CreateCall(SummaryInfo);
+ Builder.CreateCall(EndFile);
}
}
@@ -954,7 +954,7 @@ insertFlush(ArrayRef<std::pair<GlobalVariable*, MDNode*> > CountersBySP) {
assert(WriteoutF && "Need to create the writeout function first!");
IRBuilder<> Builder(Entry);
- Builder.CreateCall(WriteoutF, {});
+ Builder.CreateCall(WriteoutF);
// Zero out the counters.
for (ArrayRef<std::pair<GlobalVariable *, MDNode *> >::iterator
diff --git a/lib/Transforms/Instrumentation/InstrProfiling.cpp b/lib/Transforms/Instrumentation/InstrProfiling.cpp
index 05a9c8a..d6c83f5 100644
--- a/lib/Transforms/Instrumentation/InstrProfiling.cpp
+++ b/lib/Transforms/Instrumentation/InstrProfiling.cpp
@@ -354,7 +354,7 @@ void InstrProfiling::emitInitialization() {
// Add the basic block and the necessary calls.
IRBuilder<> IRB(BasicBlock::Create(M->getContext(), "", F));
if (RegisterF)
- IRB.CreateCall(RegisterF, {});
+ IRB.CreateCall(RegisterF);
if (!InstrProfileOutput.empty()) {
auto *Int8PtrTy = Type::getInt8PtrTy(M->getContext());
auto *SetNameTy = FunctionType::get(VoidTy, Int8PtrTy, false);
diff --git a/lib/Transforms/Instrumentation/MemorySanitizer.cpp b/lib/Transforms/Instrumentation/MemorySanitizer.cpp
index 100824e..20e7eb7 100644
--- a/lib/Transforms/Instrumentation/MemorySanitizer.cpp
+++ b/lib/Transforms/Instrumentation/MemorySanitizer.cpp
@@ -728,8 +728,8 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
IRB.CreateStore(Origin ? (Value *)Origin : (Value *)IRB.getInt32(0),
MS.OriginTLS);
}
- IRB.CreateCall(MS.WarningFn, {});
- IRB.CreateCall(MS.EmptyAsm, {});
+ IRB.CreateCall(MS.WarningFn);
+ IRB.CreateCall(MS.EmptyAsm);
// FIXME: Insert UnreachableInst if !ClKeepGoing?
// This may invalidate some of the following checks and needs to be done
// at the very end.
@@ -760,8 +760,8 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
IRB.CreateStore(Origin ? (Value *)Origin : (Value *)IRB.getInt32(0),
MS.OriginTLS);
}
- IRB.CreateCall(MS.WarningFn, {});
- IRB.CreateCall(MS.EmptyAsm, {});
+ IRB.CreateCall(MS.WarningFn);
+ IRB.CreateCall(MS.EmptyAsm);
DEBUG(dbgs() << " CHECK: " << *Cmp << "\n");
}
}
diff --git a/lib/Transforms/Instrumentation/SanitizerCoverage.cpp b/lib/Transforms/Instrumentation/SanitizerCoverage.cpp
index f6ae0c2..a39aeb2 100644
--- a/lib/Transforms/Instrumentation/SanitizerCoverage.cpp
+++ b/lib/Transforms/Instrumentation/SanitizerCoverage.cpp
@@ -410,7 +410,7 @@ void SanitizerCoverageModule::InjectCoverageAtBlock(Function &F, BasicBlock &BB,
IRB.SetCurrentDebugLocation(EntryLoc);
// __sanitizer_cov gets the PC of the instruction using GET_CALLER_PC.
IRB.CreateCall(SanCovFunction, GuardP);
- IRB.CreateCall(EmptyAsm, {}); // Avoids callback merge.
+ IRB.CreateCall(EmptyAsm); // Avoids callback merge.
}
if (Options.Use8bitCounters) {
diff --git a/lib/Transforms/Instrumentation/ThreadSanitizer.cpp b/lib/Transforms/Instrumentation/ThreadSanitizer.cpp
index 1a46bbb..10f74c1 100644
--- a/lib/Transforms/Instrumentation/ThreadSanitizer.cpp
+++ b/lib/Transforms/Instrumentation/ThreadSanitizer.cpp
@@ -398,7 +398,7 @@ bool ThreadSanitizer::runOnFunction(Function &F) {
IRB.CreateCall(TsanFuncEntry, ReturnAddress);
for (auto RetInst : RetVec) {
IRBuilder<> IRBRet(RetInst);
- IRBRet.CreateCall(TsanFuncExit, {});
+ IRBRet.CreateCall(TsanFuncExit);
}
Res = true;
}
diff --git a/unittests/ExecutionEngine/MCJIT/MCJITTest.cpp b/unittests/ExecutionEngine/MCJIT/MCJITTest.cpp
index f65ec96..94b9a69 100644
--- a/unittests/ExecutionEngine/MCJIT/MCJITTest.cpp
+++ b/unittests/ExecutionEngine/MCJIT/MCJITTest.cpp
@@ -169,7 +169,7 @@ TEST_F(MCJITTest, multiple_functions) {
std::stringstream funcName;
funcName << "level_" << i;
Outer = startFunction<int32_t(void)>(M.get(), funcName.str());
- Value *innerResult = Builder.CreateCall(Inner, {});
+ Value *innerResult = Builder.CreateCall(Inner);
endFunctionWithRet(Outer, innerResult);
Inner = Outer;
--
2.4.2
More information about the llvm-commits
mailing list