[PATCH] make use of default parameter for IRBuilder.Createcall
David Blaikie
dblaikie at gmail.com
Sun Jun 14 14:06:47 PDT 2015
Looks good - thanks!
On Jun 14, 2015 1:21 PM, <servuswiegehtz at yahoo.de> wrote:
> From: Pete Abred <servuswiegehtz at yahoo.de>
>
> Adapt users of IRBuilder.CreateCall function with no function parameters
> to make use of the added default parameter value.
>
> ---
> lib/CodeGen/CGBuiltin.cpp | 18 +++++++++---------
> lib/CodeGen/CGClass.cpp | 2 +-
> lib/CodeGen/CGDecl.cpp | 2 +-
> lib/CodeGen/CGExpr.cpp | 2 +-
> lib/CodeGen/CGObjC.cpp | 2 +-
> lib/CodeGen/CGObjCRuntime.cpp | 2 +-
> lib/CodeGen/CodeGenFunction.cpp | 2 +-
> lib/CodeGen/ItaniumCXXABI.cpp | 8 ++++----
> 8 files changed, 19 insertions(+), 19 deletions(-)
>
> diff --git a/lib/CodeGen/CGBuiltin.cpp b/lib/CodeGen/CGBuiltin.cpp
> index d86534d..d17629b 100644
> --- a/lib/CodeGen/CGBuiltin.cpp
> +++ b/lib/CodeGen/CGBuiltin.cpp
> @@ -489,7 +489,7 @@ RValue CodeGenFunction::EmitBuiltinExpr(const
> FunctionDecl *FD,
> }
> case Builtin::BI__builtin_readcyclecounter: {
> Value *F = CGM.getIntrinsic(Intrinsic::readcyclecounter);
> - return RValue::get(Builder.CreateCall(F, {}));
> + return RValue::get(Builder.CreateCall(F));
> }
> case Builtin::BI__builtin___clear_cache: {
> Value *Begin = EmitScalarExpr(E->getArg(0));
> @@ -499,11 +499,11 @@ RValue CodeGenFunction::EmitBuiltinExpr(const
> FunctionDecl *FD,
> }
> case Builtin::BI__builtin_trap: {
> Value *F = CGM.getIntrinsic(Intrinsic::trap);
> - return RValue::get(Builder.CreateCall(F, {}));
> + return RValue::get(Builder.CreateCall(F));
> }
> case Builtin::BI__debugbreak: {
> Value *F = CGM.getIntrinsic(Intrinsic::debugtrap);
> - return RValue::get(Builder.CreateCall(F, {}));
> + return RValue::get(Builder.CreateCall(F));
> }
> case Builtin::BI__builtin_unreachable: {
> if (SanOpts.has(SanitizerKind::Unreachable)) {
> @@ -881,7 +881,7 @@ RValue CodeGenFunction::EmitBuiltinExpr(const
> FunctionDecl *FD,
> }
> case Builtin::BI__builtin_unwind_init: {
> Value *F = CGM.getIntrinsic(Intrinsic::eh_unwind_init);
> - return RValue::get(Builder.CreateCall(F, {}));
> + return RValue::get(Builder.CreateCall(F));
> }
> case Builtin::BI__builtin_extend_pointer: {
> // Extends a pointer to the size of an _Unwind_Word, which is
> @@ -920,7 +920,7 @@ RValue CodeGenFunction::EmitBuiltinExpr(const
> FunctionDecl *FD,
>
> // Store the stack pointer to the setjmp buffer.
> Value *StackAddr =
> - Builder.CreateCall(CGM.getIntrinsic(Intrinsic::stacksave), {});
> + Builder.CreateCall(CGM.getIntrinsic(Intrinsic::stacksave));
> Value *StackSaveSlot =
> Builder.CreateGEP(Buf, ConstantInt::get(Int32Ty, 2));
> Builder.CreateStore(StackAddr, StackSaveSlot);
> @@ -3301,7 +3301,7 @@ Value *CodeGenFunction::EmitARMBuiltinExpr(unsigned
> BuiltinID,
> : InlineAsm::get(FTy, ".inst 0x" + utohexstr(ZExtValue),
> "",
> /*SideEffects=*/true);
>
> - return Builder.CreateCall(Emit, {});
> + return Builder.CreateCall(Emit);
> }
>
> if (BuiltinID == ARM::BI__builtin_arm_dbg) {
> @@ -3445,7 +3445,7 @@ Value *CodeGenFunction::EmitARMBuiltinExpr(unsigned
> BuiltinID,
>
> if (BuiltinID == ARM::BI__builtin_arm_clrex) {
> Function *F = CGM.getIntrinsic(Intrinsic::arm_clrex);
> - return Builder.CreateCall(F, {});
> + return Builder.CreateCall(F);
> }
>
> // CRC32
> @@ -4204,7 +4204,7 @@ Value
> *CodeGenFunction::EmitAArch64BuiltinExpr(unsigned BuiltinID,
>
> if (BuiltinID == AArch64::BI__builtin_arm_clrex) {
> Function *F = CGM.getIntrinsic(Intrinsic::aarch64_clrex);
> - return Builder.CreateCall(F, {});
> + return Builder.CreateCall(F);
> }
>
> // CRC32
> @@ -6133,7 +6133,7 @@ Value *CodeGenFunction::EmitX86BuiltinExpr(unsigned
> BuiltinID,
> break;
> }
>
> - Value *Call = Builder.CreateCall(CGM.getIntrinsic(ID), {});
> + Value *Call = Builder.CreateCall(CGM.getIntrinsic(ID));
> Builder.CreateStore(Builder.CreateExtractValue(Call, 0), Ops[0]);
> return Builder.CreateExtractValue(Call, 1);
> }
> diff --git a/lib/CodeGen/CGClass.cpp b/lib/CodeGen/CGClass.cpp
> index cd75da2..a048a11 100644
> --- a/lib/CodeGen/CGClass.cpp
> +++ b/lib/CodeGen/CGClass.cpp
> @@ -2215,7 +2215,7 @@ void CodeGenFunction::EmitVTablePtrCheck(const
> CXXRecordDecl *RD,
> Builder.CreateCondBr(BitSetTest, ContBlock, TrapBlock);
>
> EmitBlock(TrapBlock);
> - Builder.CreateCall(CGM.getIntrinsic(llvm::Intrinsic::trap), {});
> + Builder.CreateCall(CGM.getIntrinsic(llvm::Intrinsic::trap));
> Builder.CreateUnreachable();
>
> EmitBlock(ContBlock);
> diff --git a/lib/CodeGen/CGDecl.cpp b/lib/CodeGen/CGDecl.cpp
> index 579a041..fdbf1f6 100644
> --- a/lib/CodeGen/CGDecl.cpp
> +++ b/lib/CodeGen/CGDecl.cpp
> @@ -990,7 +990,7 @@ CodeGenFunction::EmitAutoVarAlloca(const VarDecl &D) {
> llvm::Value *Stack = CreateTempAlloca(Int8PtrTy, "saved_stack");
>
> llvm::Value *F = CGM.getIntrinsic(llvm::Intrinsic::stacksave);
> - llvm::Value *V = Builder.CreateCall(F, {});
> + llvm::Value *V = Builder.CreateCall(F);
>
> Builder.CreateStore(V, Stack);
>
> diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp
> index 1ed45a3..9d93cc0 100644
> --- a/lib/CodeGen/CGExpr.cpp
> +++ b/lib/CodeGen/CGExpr.cpp
> @@ -2404,7 +2404,7 @@ void CodeGenFunction::EmitTrapCheck(llvm::Value
> *Checked) {
> Builder.CreateCondBr(Checked, Cont, TrapBB);
> EmitBlock(TrapBB);
> llvm::Value *F = CGM.getIntrinsic(llvm::Intrinsic::trap);
> - llvm::CallInst *TrapCall = Builder.CreateCall(F, {});
> + llvm::CallInst *TrapCall = Builder.CreateCall(F);
> TrapCall->setDoesNotReturn();
> TrapCall->setDoesNotThrow();
> Builder.CreateUnreachable();
> diff --git a/lib/CodeGen/CGObjC.cpp b/lib/CodeGen/CGObjC.cpp
> index ef9a92d..d9270ad 100644
> --- a/lib/CodeGen/CGObjC.cpp
> +++ b/lib/CodeGen/CGObjC.cpp
> @@ -1981,7 +1981,7 @@
> CodeGenFunction::EmitARCRetainAutoreleasedReturnValue(llvm::Value *value) {
>
> // Call the marker asm if we made one, which we do only at -O0.
> if (marker)
> - Builder.CreateCall(marker, {});
> + Builder.CreateCall(marker);
>
> return emitARCValueOperation(*this, value,
>
> CGM.getARCEntrypoints().objc_retainAutoreleasedReturnValue,
> diff --git a/lib/CodeGen/CGObjCRuntime.cpp b/lib/CodeGen/CGObjCRuntime.cpp
> index 5290a87..3d013da 100644
> --- a/lib/CodeGen/CGObjCRuntime.cpp
> +++ b/lib/CodeGen/CGObjCRuntime.cpp
> @@ -160,7 +160,7 @@ namespace {
>
> void Emit(CodeGenFunction &CGF, Flags flags) override {
> if (!MightThrow) {
> - CGF.Builder.CreateCall(Fn, {})->setDoesNotThrow();
> + CGF.Builder.CreateCall(Fn)->setDoesNotThrow();
> return;
> }
>
> diff --git a/lib/CodeGen/CodeGenFunction.cpp
> b/lib/CodeGen/CodeGenFunction.cpp
> index 01da750..3c5bc1c 100644
> --- a/lib/CodeGen/CodeGenFunction.cpp
> +++ b/lib/CodeGen/CodeGenFunction.cpp
> @@ -929,7 +929,7 @@ void CodeGenFunction::GenerateCode(GlobalDecl GD,
> llvm::Function *Fn,
> "missing_return",
> EmitCheckSourceLocation(FD->getLocation()),
> None);
> } else if (CGM.getCodeGenOpts().OptimizationLevel == 0)
> - Builder.CreateCall(CGM.getIntrinsic(llvm::Intrinsic::trap), {});
> + Builder.CreateCall(CGM.getIntrinsic(llvm::Intrinsic::trap));
> Builder.CreateUnreachable();
> Builder.ClearInsertionPoint();
> }
> diff --git a/lib/CodeGen/ItaniumCXXABI.cpp b/lib/CodeGen/ItaniumCXXABI.cpp
> index 0a1a4ce..e8c28c1 100644
> --- a/lib/CodeGen/ItaniumCXXABI.cpp
> +++ b/lib/CodeGen/ItaniumCXXABI.cpp
> @@ -2090,7 +2090,7 @@ void ItaniumCXXABI::EmitThreadLocalInitFuncs(
> CGBuilderTy Builder(Entry);
> if (InitIsInitFunc) {
> if (Init)
> - Builder.CreateCall(Init, {});
> + Builder.CreateCall(Init);
> } else {
> // Don't know whether we have an init function. Call it if it
> exists.
> llvm::Value *Have = Builder.CreateIsNotNull(Init);
> @@ -2099,7 +2099,7 @@ void ItaniumCXXABI::EmitThreadLocalInitFuncs(
> Builder.CreateCondBr(Have, InitBB, ExitBB);
>
> Builder.SetInsertPoint(InitBB);
> - Builder.CreateCall(Init, {});
> + Builder.CreateCall(Init);
> Builder.CreateBr(ExitBB);
>
> Builder.SetInsertPoint(ExitBB);
> @@ -2128,7 +2128,7 @@ LValue
> ItaniumCXXABI::EmitThreadLocalVarDeclLValue(CodeGenFunction &CGF,
> llvm::Value *Val = CGF.CGM.GetAddrOfGlobalVar(VD, Ty);
> llvm::Function *Wrapper = getOrCreateThreadLocalWrapper(VD, Val);
>
> - Val = CGF.Builder.CreateCall(Wrapper, {});
> + Val = CGF.Builder.CreateCall(Wrapper);
>
> LValue LV;
> if (VD->getType()->isReferenceType())
> @@ -3615,7 +3615,7 @@ static llvm::Constant
> *getClangCallTerminateFn(CodeGenModule &CGM) {
> catchCall->setCallingConv(CGM.getRuntimeCC());
>
> // Call std::terminate().
> - llvm::CallInst *termCall = builder.CreateCall(CGM.getTerminateFn(),
> {});
> + llvm::CallInst *termCall = builder.CreateCall(CGM.getTerminateFn());
> termCall->setDoesNotThrow();
> termCall->setDoesNotReturn();
> termCall->setCallingConv(CGM.getRuntimeCC());
> --
> 2.4.2
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150614/5be66f62/attachment.html>
More information about the cfe-commits
mailing list