mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 18:54:02 +01:00
Simplify IRBuilder::CreateCall* by using ArrayRef+initializer_list/braced init only
llvm-svn: 237624
This commit is contained in:
parent
6ff66ff447
commit
0be3b52a8f
@ -1461,39 +1461,6 @@ public:
|
||||
return Insert(PHINode::Create(Ty, NumReservedValues), Name);
|
||||
}
|
||||
|
||||
CallInst *CreateCall(Value *Callee, const Twine &Name = "") {
|
||||
return Insert(CallInst::Create(Callee), Name);
|
||||
}
|
||||
CallInst *CreateCall(Value *Callee, Value *Arg, const Twine &Name = "") {
|
||||
return Insert(CallInst::Create(Callee, Arg), Name);
|
||||
}
|
||||
CallInst *CreateCall2(Value *Callee, Value *Arg1, Value *Arg2,
|
||||
const Twine &Name = "") {
|
||||
return CreateCall2(cast<FunctionType>(cast<PointerType>(Callee->getType())
|
||||
->getElementType()),
|
||||
Callee, Arg1, Arg2, Name);
|
||||
}
|
||||
CallInst *CreateCall2(FunctionType *Ty, Value *Callee, Value *Arg1,
|
||||
Value *Arg2, const Twine &Name = "") {
|
||||
Value *Args[] = { Arg1, Arg2 };
|
||||
return Insert(CallInst::Create(Ty, Callee, Args), Name);
|
||||
}
|
||||
CallInst *CreateCall3(Value *Callee, Value *Arg1, Value *Arg2, Value *Arg3,
|
||||
const Twine &Name = "") {
|
||||
Value *Args[] = { Arg1, Arg2, Arg3 };
|
||||
return Insert(CallInst::Create(Callee, Args), Name);
|
||||
}
|
||||
CallInst *CreateCall4(Value *Callee, Value *Arg1, Value *Arg2, Value *Arg3,
|
||||
Value *Arg4, const Twine &Name = "") {
|
||||
Value *Args[] = { Arg1, Arg2, Arg3, Arg4 };
|
||||
return Insert(CallInst::Create(Callee, Args), Name);
|
||||
}
|
||||
CallInst *CreateCall5(Value *Callee, Value *Arg1, Value *Arg2, Value *Arg3,
|
||||
Value *Arg4, Value *Arg5, const Twine &Name = "") {
|
||||
Value *Args[] = { Arg1, Arg2, Arg3, Arg4, Arg5 };
|
||||
return Insert(CallInst::Create(Callee, Args), Name);
|
||||
}
|
||||
|
||||
CallInst *CreateCall(Value *Callee, ArrayRef<Value *> Args,
|
||||
const Twine &Name = "") {
|
||||
return Insert(CallInst::Create(Callee, Args), Name);
|
||||
|
@ -235,7 +235,7 @@ Value *SjLjEHPrepare::setupFunctionContext(Function &F,
|
||||
PersonalityFieldPtr, /*isVolatile=*/true);
|
||||
|
||||
// LSDA address
|
||||
Value *LSDA = Builder.CreateCall(LSDAAddrFn, "lsda_addr");
|
||||
Value *LSDA = Builder.CreateCall(LSDAAddrFn, {}, "lsda_addr");
|
||||
Value *LSDAFieldPtr =
|
||||
Builder.CreateConstGEP2_32(FunctionContextTy, FuncCtx, 0, 4, "lsda_gep");
|
||||
Builder.CreateStore(LSDA, LSDAFieldPtr, /*isVolatile=*/true);
|
||||
@ -420,7 +420,7 @@ bool SjLjEHPrepare::setupEntryBlockAndCallSites(Function &F) {
|
||||
Value *StackPtr = Builder.CreateConstGEP2_32(doubleUnderJBufTy, JBufPtr, 0, 2,
|
||||
"jbuf_sp_gep");
|
||||
|
||||
Val = Builder.CreateCall(StackAddrFn, "sp");
|
||||
Val = Builder.CreateCall(StackAddrFn, {}, "sp");
|
||||
Builder.CreateStore(Val, StackPtr, /*isVolatile=*/true);
|
||||
|
||||
// Call the setjmp instrinsic. It fills in the rest of the jmpbuf.
|
||||
|
@ -353,8 +353,8 @@ static bool CreatePrologue(Function *F, Module *M, ReturnInst *RI,
|
||||
IRBuilder<> B(&F->getEntryBlock().front());
|
||||
AI = B.CreateAlloca(PtrTy, nullptr, "StackGuardSlot");
|
||||
LoadInst *LI = B.CreateLoad(StackGuardVar, "StackGuard");
|
||||
B.CreateCall2(Intrinsic::getDeclaration(M, Intrinsic::stackprotector), LI,
|
||||
AI);
|
||||
B.CreateCall(Intrinsic::getDeclaration(M, Intrinsic::stackprotector),
|
||||
{LI, AI});
|
||||
|
||||
return SupportsSelectionDAGSP;
|
||||
}
|
||||
@ -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;
|
||||
|
@ -1208,7 +1208,7 @@ static BasicBlock *createStubLandingPad(Function *Handler,
|
||||
// Insert a call to llvm.eh.actions so that we don't try to outline this lpad.
|
||||
Function *ActionIntrin =
|
||||
Intrinsic::getDeclaration(Handler->getParent(), Intrinsic::eh_actions);
|
||||
Builder.CreateCall(ActionIntrin, "recover");
|
||||
Builder.CreateCall(ActionIntrin, {}, "recover");
|
||||
LPad->setCleanup(true);
|
||||
Builder.CreateUnreachable();
|
||||
return StubBB;
|
||||
@ -1453,7 +1453,7 @@ void WinEHPrepare::processSEHCatchHandler(CatchHandler *CatchAction,
|
||||
IRBuilder<> Builder(HandlerBB->getFirstInsertionPt());
|
||||
Function *EHCodeFn = Intrinsic::getDeclaration(
|
||||
StartBB->getParent()->getParent(), Intrinsic::eh_exceptioncode);
|
||||
Value *Code = Builder.CreateCall(EHCodeFn, "sehcode");
|
||||
Value *Code = Builder.CreateCall(EHCodeFn, {}, "sehcode");
|
||||
Code = Builder.CreateIntToPtr(Code, SEHExceptionCodeSlot->getAllocatedType());
|
||||
Builder.CreateStore(Code, SEHExceptionCodeSlot);
|
||||
CatchAction->setHandlerBlockOrFunc(BlockAddress::get(HandlerBB));
|
||||
|
@ -416,13 +416,14 @@ void llvm::UpgradeIntrinsicCall(CallInst *CI, Function *NewFn) {
|
||||
llvm_unreachable("Unknown condition");
|
||||
|
||||
Function *VPCOM = Intrinsic::getDeclaration(F->getParent(), intID);
|
||||
Rep = Builder.CreateCall3(VPCOM, CI->getArgOperand(0),
|
||||
CI->getArgOperand(1), Builder.getInt8(Imm));
|
||||
Rep =
|
||||
Builder.CreateCall(VPCOM, {CI->getArgOperand(0), CI->getArgOperand(1),
|
||||
Builder.getInt8(Imm)});
|
||||
} else if (Name == "llvm.x86.sse42.crc32.64.8") {
|
||||
Function *CRC32 = Intrinsic::getDeclaration(F->getParent(),
|
||||
Intrinsic::x86_sse42_crc32_32_8);
|
||||
Value *Trunc0 = Builder.CreateTrunc(CI->getArgOperand(0), Type::getInt32Ty(C));
|
||||
Rep = Builder.CreateCall2(CRC32, Trunc0, CI->getArgOperand(1));
|
||||
Rep = Builder.CreateCall(CRC32, {Trunc0, CI->getArgOperand(1)});
|
||||
Rep = Builder.CreateZExt(Rep, CI->getType(), "");
|
||||
} else if (Name.startswith("llvm.x86.avx.vbroadcast")) {
|
||||
// Replace broadcasts with a series of insertelements.
|
||||
@ -630,29 +631,27 @@ void llvm::UpgradeIntrinsicCall(CallInst *CI, Function *NewFn) {
|
||||
case Intrinsic::cttz:
|
||||
assert(CI->getNumArgOperands() == 1 &&
|
||||
"Mismatch between function args and call args");
|
||||
CI->replaceAllUsesWith(Builder.CreateCall2(NewFn, CI->getArgOperand(0),
|
||||
Builder.getFalse(), Name));
|
||||
CI->replaceAllUsesWith(Builder.CreateCall(
|
||||
NewFn, {CI->getArgOperand(0), Builder.getFalse()}, Name));
|
||||
CI->eraseFromParent();
|
||||
return;
|
||||
|
||||
case Intrinsic::objectsize:
|
||||
CI->replaceAllUsesWith(Builder.CreateCall2(NewFn,
|
||||
CI->getArgOperand(0),
|
||||
CI->getArgOperand(1),
|
||||
Name));
|
||||
CI->replaceAllUsesWith(Builder.CreateCall(
|
||||
NewFn, {CI->getArgOperand(0), CI->getArgOperand(1)}, Name));
|
||||
CI->eraseFromParent();
|
||||
return;
|
||||
|
||||
case Intrinsic::ctpop: {
|
||||
CI->replaceAllUsesWith(Builder.CreateCall(NewFn, CI->getArgOperand(0)));
|
||||
CI->replaceAllUsesWith(Builder.CreateCall(NewFn, {CI->getArgOperand(0)}));
|
||||
CI->eraseFromParent();
|
||||
return;
|
||||
}
|
||||
|
||||
case Intrinsic::x86_xop_vfrcz_ss:
|
||||
case Intrinsic::x86_xop_vfrcz_sd:
|
||||
CI->replaceAllUsesWith(Builder.CreateCall(NewFn, CI->getArgOperand(1),
|
||||
Name));
|
||||
CI->replaceAllUsesWith(
|
||||
Builder.CreateCall(NewFn, {CI->getArgOperand(1)}, Name));
|
||||
CI->eraseFromParent();
|
||||
return;
|
||||
|
||||
@ -675,9 +674,7 @@ void llvm::UpgradeIntrinsicCall(CallInst *CI, Function *NewFn) {
|
||||
Value *BC0 = Builder.CreateBitCast(Arg0, NewVecTy, "cast");
|
||||
Value *BC1 = Builder.CreateBitCast(Arg1, NewVecTy, "cast");
|
||||
|
||||
Type *Ty[] = {NewVecTy, NewVecTy};
|
||||
CallInst *NewCall = Builder.CreateCall2(
|
||||
FunctionType::get(CI->getType(), Ty, false), NewFn, BC0, BC1, Name);
|
||||
CallInst *NewCall = Builder.CreateCall(NewFn, {BC0, BC1}, Name);
|
||||
CI->replaceAllUsesWith(NewCall);
|
||||
CI->eraseFromParent();
|
||||
return;
|
||||
|
@ -9101,7 +9101,7 @@ Value *AArch64TargetLowering::emitStoreConditional(IRBuilder<> &Builder,
|
||||
Value *Lo = Builder.CreateTrunc(Val, Int64Ty, "lo");
|
||||
Value *Hi = Builder.CreateTrunc(Builder.CreateLShr(Val, 64), Int64Ty, "hi");
|
||||
Addr = Builder.CreateBitCast(Addr, Type::getInt8PtrTy(M->getContext()));
|
||||
return Builder.CreateCall3(Stxr, Lo, Hi, Addr);
|
||||
return Builder.CreateCall(Stxr, {Lo, Hi, Addr});
|
||||
}
|
||||
|
||||
Intrinsic::ID Int =
|
||||
@ -9109,10 +9109,10 @@ Value *AArch64TargetLowering::emitStoreConditional(IRBuilder<> &Builder,
|
||||
Type *Tys[] = { Addr->getType() };
|
||||
Function *Stxr = Intrinsic::getDeclaration(M, Int, Tys);
|
||||
|
||||
return Builder.CreateCall2(
|
||||
Stxr, Builder.CreateZExtOrBitCast(
|
||||
return Builder.CreateCall(Stxr,
|
||||
{Builder.CreateZExtOrBitCast(
|
||||
Val, Stxr->getFunctionType()->getParamType(0)),
|
||||
Addr);
|
||||
Addr});
|
||||
}
|
||||
|
||||
bool AArch64TargetLowering::functionArgumentNeedsConsecutiveRegisters(
|
||||
|
@ -11295,17 +11295,17 @@ Value *ARMTargetLowering::emitStoreConditional(IRBuilder<> &Builder, Value *Val,
|
||||
if (!Subtarget->isLittle())
|
||||
std::swap (Lo, Hi);
|
||||
Addr = Builder.CreateBitCast(Addr, Type::getInt8PtrTy(M->getContext()));
|
||||
return Builder.CreateCall3(Strex, Lo, Hi, Addr);
|
||||
return Builder.CreateCall(Strex, {Lo, Hi, Addr});
|
||||
}
|
||||
|
||||
Intrinsic::ID Int = IsRelease ? Intrinsic::arm_stlex : Intrinsic::arm_strex;
|
||||
Type *Tys[] = { Addr->getType() };
|
||||
Function *Strex = Intrinsic::getDeclaration(M, Int, Tys);
|
||||
|
||||
return Builder.CreateCall2(
|
||||
Strex, Builder.CreateZExtOrBitCast(
|
||||
return Builder.CreateCall(
|
||||
Strex, {Builder.CreateZExtOrBitCast(
|
||||
Val, Strex->getFunctionType()->getParamType(0)),
|
||||
Addr);
|
||||
Addr});
|
||||
}
|
||||
|
||||
enum HABaseType {
|
||||
|
@ -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);
|
||||
|
||||
|
@ -7880,7 +7880,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
|
||||
@ -7890,9 +7890,8 @@ Instruction* PPCTargetLowering::emitLeadingFence(IRBuilder<> &Builder,
|
||||
bool IsLoad) const {
|
||||
if (Ord == SequentiallyConsistent)
|
||||
return callIntrinsic(Builder, Intrinsic::ppc_sync);
|
||||
else if (isAtLeastRelease(Ord))
|
||||
if (isAtLeastRelease(Ord))
|
||||
return callIntrinsic(Builder, Intrinsic::ppc_lwsync);
|
||||
else
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -7905,7 +7904,6 @@ Instruction* PPCTargetLowering::emitTrailingFence(IRBuilder<> &Builder,
|
||||
// See http://www.cl.cam.ac.uk/~pes20/cpp/cpp0xmappings.html and
|
||||
// http://www.rdrop.com/users/paulmck/scalability/paper/N2745r.2011.03.04a.html
|
||||
// and http://www.cl.cam.ac.uk/~pes20/cppppc/ for justification.
|
||||
else
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -217,9 +217,11 @@ bool PPCLoopDataPrefetch::runOnLoop(Loop *L) {
|
||||
Module *M = (*I)->getParent()->getParent();
|
||||
Type *I32 = Type::getInt32Ty((*I)->getContext());
|
||||
Value *PrefetchFunc = Intrinsic::getDeclaration(M, Intrinsic::prefetch);
|
||||
Builder.CreateCall4(PrefetchFunc, PrefPtrValue,
|
||||
Builder.CreateCall(
|
||||
PrefetchFunc,
|
||||
{PrefPtrValue,
|
||||
ConstantInt::get(I32, MemI->mayReadFromMemory() ? 0 : 1),
|
||||
ConstantInt::get(I32, 3), ConstantInt::get(I32, 1));
|
||||
ConstantInt::get(I32, 3), ConstantInt::get(I32, 1)});
|
||||
|
||||
MadeChange = true;
|
||||
}
|
||||
|
@ -316,12 +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);
|
||||
|
@ -16985,21 +16985,21 @@ X86TargetLowering::lowerIdempotentRMWIntoFencedLoad(AtomicRMWInst *AI) const {
|
||||
// otherwise, we might be able to be more agressive on relaxed idempotent
|
||||
// rmw. In practice, they do not look useful, so we don't try to be
|
||||
// especially clever.
|
||||
if (SynchScope == SingleThread) {
|
||||
if (SynchScope == SingleThread)
|
||||
// FIXME: we could just insert an X86ISD::MEMBARRIER here, except we are at
|
||||
// the IR level, so we must wrap it in an intrinsic.
|
||||
return nullptr;
|
||||
} else if (hasMFENCE(*Subtarget)) {
|
||||
Function *MFence = llvm::Intrinsic::getDeclaration(M,
|
||||
Intrinsic::x86_sse2_mfence);
|
||||
Builder.CreateCall(MFence);
|
||||
} else {
|
||||
|
||||
if (!hasMFENCE(*Subtarget))
|
||||
// FIXME: it might make sense to use a locked operation here but on a
|
||||
// different cache-line to prevent cache-line bouncing. In practice it
|
||||
// is probably a small win, and x86 processors without mfence are rare
|
||||
// enough that we do not bother.
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Function *MFence =
|
||||
llvm::Intrinsic::getDeclaration(M, Intrinsic::x86_sse2_mfence);
|
||||
Builder.CreateCall(MFence, {});
|
||||
|
||||
// Finally we can emit the atomic load.
|
||||
LoadInst *Loaded = Builder.CreateAlignedLoad(Ptr,
|
||||
|
@ -232,7 +232,7 @@ void WinEHStatePass::emitExceptionRegistrationRecord(Function *F) {
|
||||
// FIXME: We can skip this in -GS- mode, when we figure that out.
|
||||
// SavedESP = llvm.stacksave()
|
||||
Value *SP = Builder.CreateCall(
|
||||
Intrinsic::getDeclaration(TheModule, Intrinsic::stacksave));
|
||||
Intrinsic::getDeclaration(TheModule, Intrinsic::stacksave), {});
|
||||
Builder.CreateStore(SP, Builder.CreateStructGEP(RegNodeTy, RegNode, 0));
|
||||
// TryLevel = -1
|
||||
Builder.CreateStore(Builder.getInt32(-1),
|
||||
@ -258,7 +258,7 @@ void WinEHStatePass::emitExceptionRegistrationRecord(Function *F) {
|
||||
Value *RegNode = Builder.CreateAlloca(RegNodeTy);
|
||||
// SavedESP = llvm.stacksave()
|
||||
Value *SP = Builder.CreateCall(
|
||||
Intrinsic::getDeclaration(TheModule, Intrinsic::stacksave));
|
||||
Intrinsic::getDeclaration(TheModule, Intrinsic::stacksave), {});
|
||||
Builder.CreateStore(SP, Builder.CreateStructGEP(RegNodeTy, RegNode, 0));
|
||||
// TryLevel = -2
|
||||
Builder.CreateStore(Builder.getInt32(-2),
|
||||
|
@ -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);
|
||||
|
@ -2097,7 +2097,7 @@ static Instruction *ProcessUGT_ADDCST_ADD(ICmpInst &I, Value *A, Value *B,
|
||||
|
||||
Value *TruncA = Builder->CreateTrunc(A, NewType, A->getName()+".trunc");
|
||||
Value *TruncB = Builder->CreateTrunc(B, NewType, B->getName()+".trunc");
|
||||
CallInst *Call = Builder->CreateCall2(F, TruncA, TruncB, "sadd");
|
||||
CallInst *Call = Builder->CreateCall(F, {TruncA, TruncB}, "sadd");
|
||||
Value *Add = Builder->CreateExtractValue(Call, 0, "sadd.result");
|
||||
Value *ZExt = Builder->CreateZExt(Add, OrigAdd->getType());
|
||||
|
||||
@ -2384,7 +2384,7 @@ static Instruction *ProcessUMulZExtIdiom(ICmpInst &I, Value *MulVal,
|
||||
MulB = Builder->CreateZExt(B, MulType);
|
||||
Value *F =
|
||||
Intrinsic::getDeclaration(M, Intrinsic::umul_with_overflow, MulType);
|
||||
CallInst *Call = Builder->CreateCall2(F, MulA, MulB, "umul");
|
||||
CallInst *Call = Builder->CreateCall(F, {MulA, MulB}, "umul");
|
||||
IC.Worklist.Add(MulInstr);
|
||||
|
||||
// If there are uses of mul result other than the comparison, we know that
|
||||
|
@ -789,17 +789,17 @@ Value *AddressSanitizer::memToShadow(Value *Shadow, IRBuilder<> &IRB) {
|
||||
void AddressSanitizer::instrumentMemIntrinsic(MemIntrinsic *MI) {
|
||||
IRBuilder<> IRB(MI);
|
||||
if (isa<MemTransferInst>(MI)) {
|
||||
IRB.CreateCall3(
|
||||
IRB.CreateCall(
|
||||
isa<MemMoveInst>(MI) ? AsanMemmove : AsanMemcpy,
|
||||
IRB.CreatePointerCast(MI->getOperand(0), IRB.getInt8PtrTy()),
|
||||
{IRB.CreatePointerCast(MI->getOperand(0), IRB.getInt8PtrTy()),
|
||||
IRB.CreatePointerCast(MI->getOperand(1), IRB.getInt8PtrTy()),
|
||||
IRB.CreateIntCast(MI->getOperand(2), IntptrTy, false));
|
||||
IRB.CreateIntCast(MI->getOperand(2), IntptrTy, false)});
|
||||
} else if (isa<MemSetInst>(MI)) {
|
||||
IRB.CreateCall3(
|
||||
IRB.CreateCall(
|
||||
AsanMemset,
|
||||
IRB.CreatePointerCast(MI->getOperand(0), IRB.getInt8PtrTy()),
|
||||
{IRB.CreatePointerCast(MI->getOperand(0), IRB.getInt8PtrTy()),
|
||||
IRB.CreateIntCast(MI->getOperand(1), IRB.getInt32Ty(), false),
|
||||
IRB.CreateIntCast(MI->getOperand(2), IntptrTy, false));
|
||||
IRB.CreateIntCast(MI->getOperand(2), IntptrTy, false)});
|
||||
}
|
||||
MI->eraseFromParent();
|
||||
}
|
||||
@ -906,7 +906,7 @@ void AddressSanitizer::instrumentPointerComparisonOrSubtraction(
|
||||
if (Param[i]->getType()->isPointerTy())
|
||||
Param[i] = IRB.CreatePointerCast(Param[i], IntptrTy);
|
||||
}
|
||||
IRB.CreateCall2(F, Param[0], Param[1]);
|
||||
IRB.CreateCall(F, Param);
|
||||
}
|
||||
|
||||
void AddressSanitizer::instrumentMop(ObjectSizeOffsetVisitor &ObjSizeVis,
|
||||
@ -978,24 +978,24 @@ Instruction *AddressSanitizer::generateCrashCode(Instruction *InsertBefore,
|
||||
CallInst *Call = nullptr;
|
||||
if (SizeArgument) {
|
||||
if (Exp == 0)
|
||||
Call = IRB.CreateCall2(AsanErrorCallbackSized[IsWrite][0], Addr,
|
||||
SizeArgument);
|
||||
Call = IRB.CreateCall(AsanErrorCallbackSized[IsWrite][0],
|
||||
{Addr, SizeArgument});
|
||||
else
|
||||
Call = IRB.CreateCall3(AsanErrorCallbackSized[IsWrite][1], Addr,
|
||||
SizeArgument, ExpVal);
|
||||
Call = IRB.CreateCall(AsanErrorCallbackSized[IsWrite][1],
|
||||
{Addr, SizeArgument, ExpVal});
|
||||
} else {
|
||||
if (Exp == 0)
|
||||
Call =
|
||||
IRB.CreateCall(AsanErrorCallback[IsWrite][0][AccessSizeIndex], Addr);
|
||||
else
|
||||
Call = IRB.CreateCall2(AsanErrorCallback[IsWrite][1][AccessSizeIndex],
|
||||
Addr, ExpVal);
|
||||
Call = IRB.CreateCall(AsanErrorCallback[IsWrite][1][AccessSizeIndex],
|
||||
{Addr, ExpVal});
|
||||
}
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
@ -1031,8 +1031,8 @@ void AddressSanitizer::instrumentAddress(Instruction *OrigIns,
|
||||
IRB.CreateCall(AsanMemoryAccessCallback[IsWrite][0][AccessSizeIndex],
|
||||
AddrLong);
|
||||
else
|
||||
IRB.CreateCall2(AsanMemoryAccessCallback[IsWrite][1][AccessSizeIndex],
|
||||
AddrLong, ConstantInt::get(IRB.getInt32Ty(), Exp));
|
||||
IRB.CreateCall(AsanMemoryAccessCallback[IsWrite][1][AccessSizeIndex],
|
||||
{AddrLong, ConstantInt::get(IRB.getInt32Ty(), Exp)});
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1083,11 +1083,11 @@ void AddressSanitizer::instrumentUnusualSizeOrAlignment(
|
||||
Value *AddrLong = IRB.CreatePointerCast(Addr, IntptrTy);
|
||||
if (UseCalls) {
|
||||
if (Exp == 0)
|
||||
IRB.CreateCall2(AsanMemoryAccessCallbackSized[IsWrite][0], AddrLong,
|
||||
Size);
|
||||
IRB.CreateCall(AsanMemoryAccessCallbackSized[IsWrite][0],
|
||||
{AddrLong, Size});
|
||||
else
|
||||
IRB.CreateCall3(AsanMemoryAccessCallbackSized[IsWrite][1], AddrLong, Size,
|
||||
ConstantInt::get(IRB.getInt32Ty(), Exp));
|
||||
IRB.CreateCall(AsanMemoryAccessCallbackSized[IsWrite][1],
|
||||
{AddrLong, Size, ConstantInt::get(IRB.getInt32Ty(), Exp)});
|
||||
} else {
|
||||
Value *LastByte = IRB.CreateIntToPtr(
|
||||
IRB.CreateAdd(AddrLong, ConstantInt::get(IntptrTy, TypeSize / 8 - 1)),
|
||||
@ -1347,9 +1347,9 @@ bool AddressSanitizerModule::InstrumentGlobals(IRBuilder<> &IRB, Module &M) {
|
||||
// Create calls for poisoning before initializers run and unpoisoning after.
|
||||
if (HasDynamicallyInitializedGlobals)
|
||||
createInitializerPoisonCalls(M, ModuleName);
|
||||
IRB.CreateCall2(AsanRegisterGlobals,
|
||||
IRB.CreatePointerCast(AllGlobals, IntptrTy),
|
||||
ConstantInt::get(IntptrTy, n));
|
||||
IRB.CreateCall(AsanRegisterGlobals,
|
||||
{IRB.CreatePointerCast(AllGlobals, IntptrTy),
|
||||
ConstantInt::get(IntptrTy, n)});
|
||||
|
||||
// We also need to unregister globals at the end, e.g. when a shared library
|
||||
// gets closed.
|
||||
@ -1358,9 +1358,9 @@ bool AddressSanitizerModule::InstrumentGlobals(IRBuilder<> &IRB, Module &M) {
|
||||
GlobalValue::InternalLinkage, kAsanModuleDtorName, &M);
|
||||
BasicBlock *AsanDtorBB = BasicBlock::Create(*C, "", AsanDtorFunction);
|
||||
IRBuilder<> IRB_Dtor(ReturnInst::Create(*C, AsanDtorBB));
|
||||
IRB_Dtor.CreateCall2(AsanUnregisterGlobals,
|
||||
IRB.CreatePointerCast(AllGlobals, IntptrTy),
|
||||
ConstantInt::get(IntptrTy, n));
|
||||
IRB_Dtor.CreateCall(AsanUnregisterGlobals,
|
||||
{IRB.CreatePointerCast(AllGlobals, IntptrTy),
|
||||
ConstantInt::get(IntptrTy, n)});
|
||||
appendToGlobalDtors(M, AsanDtorFunction, kAsanCtorAndDtorPriority);
|
||||
|
||||
DEBUG(dbgs() << M);
|
||||
@ -1473,7 +1473,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;
|
||||
@ -1573,7 +1573,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) {
|
||||
@ -1887,8 +1887,9 @@ void FunctionStackPoisoner::poisonStack() {
|
||||
IRBPoison.CreateIntToPtr(SavedFlagPtr, IRBPoison.getInt8PtrTy()));
|
||||
} else {
|
||||
// For larger frames call __asan_stack_free_*.
|
||||
IRBPoison.CreateCall2(AsanStackFreeFunc[StackMallocIdx], FakeStack,
|
||||
ConstantInt::get(IntptrTy, LocalStackSize));
|
||||
IRBPoison.CreateCall(
|
||||
AsanStackFreeFunc[StackMallocIdx],
|
||||
{FakeStack, ConstantInt::get(IntptrTy, LocalStackSize)});
|
||||
}
|
||||
|
||||
IRBuilder<> IRBElse(ElseTerm);
|
||||
@ -1911,9 +1912,9 @@ void FunctionStackPoisoner::poisonAlloca(Value *V, uint64_t Size,
|
||||
// For now just insert the call to ASan runtime.
|
||||
Value *AddrArg = IRB.CreatePointerCast(V, IntptrTy);
|
||||
Value *SizeArg = ConstantInt::get(IntptrTy, Size);
|
||||
IRB.CreateCall2(
|
||||
DoPoison ? AsanPoisonStackMemoryFunc : AsanUnpoisonStackMemoryFunc,
|
||||
AddrArg, SizeArg);
|
||||
IRB.CreateCall(DoPoison ? AsanPoisonStackMemoryFunc
|
||||
: AsanUnpoisonStackMemoryFunc,
|
||||
{AddrArg, SizeArg});
|
||||
}
|
||||
|
||||
// Handling llvm.lifetime intrinsics for a given %alloca:
|
||||
|
@ -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());
|
||||
|
@ -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) {
|
||||
@ -972,7 +972,7 @@ Value *DFSanFunction::combineShadows(Value *V1, Value *V2, Instruction *Pos) {
|
||||
|
||||
IRBuilder<> IRB(Pos);
|
||||
if (AvoidNewBlocks) {
|
||||
CallInst *Call = IRB.CreateCall2(DFS.DFSanCheckedUnionFn, V1, V2);
|
||||
CallInst *Call = IRB.CreateCall(DFS.DFSanCheckedUnionFn, {V1, V2});
|
||||
Call->addAttribute(AttributeSet::ReturnIndex, Attribute::ZExt);
|
||||
Call->addAttribute(1, Attribute::ZExt);
|
||||
Call->addAttribute(2, Attribute::ZExt);
|
||||
@ -985,7 +985,7 @@ Value *DFSanFunction::combineShadows(Value *V1, Value *V2, Instruction *Pos) {
|
||||
BranchInst *BI = cast<BranchInst>(SplitBlockAndInsertIfThen(
|
||||
Ne, Pos, /*Unreachable=*/false, DFS.ColdCallWeights, &DT));
|
||||
IRBuilder<> ThenIRB(BI);
|
||||
CallInst *Call = ThenIRB.CreateCall2(DFS.DFSanUnionFn, V1, V2);
|
||||
CallInst *Call = ThenIRB.CreateCall(DFS.DFSanUnionFn, {V1, V2});
|
||||
Call->addAttribute(AttributeSet::ReturnIndex, Attribute::ZExt);
|
||||
Call->addAttribute(1, Attribute::ZExt);
|
||||
Call->addAttribute(2, Attribute::ZExt);
|
||||
@ -1087,8 +1087,9 @@ Value *DFSanFunction::loadShadow(Value *Addr, uint64_t Size, uint64_t Align,
|
||||
// shadow is non-equal.
|
||||
BasicBlock *FallbackBB = BasicBlock::Create(*DFS.Ctx, "", F);
|
||||
IRBuilder<> FallbackIRB(FallbackBB);
|
||||
CallInst *FallbackCall = FallbackIRB.CreateCall2(
|
||||
DFS.DFSanUnionLoadFn, ShadowAddr, ConstantInt::get(DFS.IntptrTy, Size));
|
||||
CallInst *FallbackCall = FallbackIRB.CreateCall(
|
||||
DFS.DFSanUnionLoadFn,
|
||||
{ShadowAddr, ConstantInt::get(DFS.IntptrTy, Size)});
|
||||
FallbackCall->addAttribute(AttributeSet::ReturnIndex, Attribute::ZExt);
|
||||
|
||||
// Compare each of the shadows stored in the loaded 64 bits to each other,
|
||||
@ -1144,8 +1145,8 @@ Value *DFSanFunction::loadShadow(Value *Addr, uint64_t Size, uint64_t Align,
|
||||
}
|
||||
|
||||
IRBuilder<> IRB(Pos);
|
||||
CallInst *FallbackCall = IRB.CreateCall2(
|
||||
DFS.DFSanUnionLoadFn, ShadowAddr, ConstantInt::get(DFS.IntptrTy, Size));
|
||||
CallInst *FallbackCall = IRB.CreateCall(
|
||||
DFS.DFSanUnionLoadFn, {ShadowAddr, ConstantInt::get(DFS.IntptrTy, Size)});
|
||||
FallbackCall->addAttribute(AttributeSet::ReturnIndex, Attribute::ZExt);
|
||||
return FallbackCall;
|
||||
}
|
||||
@ -1332,10 +1333,10 @@ void DFSanVisitor::visitSelectInst(SelectInst &I) {
|
||||
void DFSanVisitor::visitMemSetInst(MemSetInst &I) {
|
||||
IRBuilder<> IRB(&I);
|
||||
Value *ValShadow = DFSF.getShadow(I.getValue());
|
||||
IRB.CreateCall3(
|
||||
DFSF.DFS.DFSanSetLabelFn, ValShadow,
|
||||
IRB.CreateBitCast(I.getDest(), Type::getInt8PtrTy(*DFSF.DFS.Ctx)),
|
||||
IRB.CreateZExtOrTrunc(I.getLength(), DFSF.DFS.IntptrTy));
|
||||
IRB.CreateCall(DFSF.DFS.DFSanSetLabelFn,
|
||||
{ValShadow, IRB.CreateBitCast(I.getDest(), Type::getInt8PtrTy(
|
||||
*DFSF.DFS.Ctx)),
|
||||
IRB.CreateZExtOrTrunc(I.getLength(), DFSF.DFS.IntptrTy)});
|
||||
}
|
||||
|
||||
void DFSanVisitor::visitMemTransferInst(MemTransferInst &I) {
|
||||
@ -1357,8 +1358,8 @@ void DFSanVisitor::visitMemTransferInst(MemTransferInst &I) {
|
||||
Type *Int8Ptr = Type::getInt8PtrTy(*DFSF.DFS.Ctx);
|
||||
DestShadow = IRB.CreateBitCast(DestShadow, Int8Ptr);
|
||||
SrcShadow = IRB.CreateBitCast(SrcShadow, Int8Ptr);
|
||||
IRB.CreateCall5(I.getCalledValue(), DestShadow, SrcShadow, LenShadow,
|
||||
AlignShadow, I.getVolatileCst());
|
||||
IRB.CreateCall(I.getCalledValue(), {DestShadow, SrcShadow, LenShadow,
|
||||
AlignShadow, I.getVolatileCst()});
|
||||
}
|
||||
|
||||
void DFSanVisitor::visitReturnInst(ReturnInst &RI) {
|
||||
|
@ -654,8 +654,8 @@ bool GCOVProfiler::emitProfileArcs() {
|
||||
|
||||
// Build code to increment the counter.
|
||||
InsertIndCounterIncrCode = true;
|
||||
Builder.CreateCall2(getIncrementIndirectCounterFunc(),
|
||||
EdgeState, CounterPtrArray);
|
||||
Builder.CreateCall(getIncrementIndirectCounterFunc(),
|
||||
{EdgeState, CounterPtrArray});
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -688,7 +688,7 @@ bool GCOVProfiler::emitProfileArcs() {
|
||||
// Initialize the environment and register the local writeout and flush
|
||||
// functions.
|
||||
Constant *GCOVInit = M->getOrInsertFunction("llvm_gcov_init", FTy);
|
||||
Builder.CreateCall2(GCOVInit, WriteoutF, FlushF);
|
||||
Builder.CreateCall(GCOVInit, {WriteoutF, FlushF});
|
||||
Builder.CreateRetVoid();
|
||||
|
||||
appendToGlobalCtors(*M, F, 0);
|
||||
@ -850,31 +850,31 @@ Function *GCOVProfiler::insertCounterWriteout(
|
||||
auto *CU = cast<DICompileUnit>(CU_Nodes->getOperand(i));
|
||||
std::string FilenameGcda = mangleName(CU, "gcda");
|
||||
uint32_t CfgChecksum = FileChecksums.empty() ? 0 : FileChecksums[i];
|
||||
Builder.CreateCall3(StartFile,
|
||||
Builder.CreateGlobalStringPtr(FilenameGcda),
|
||||
Builder.CreateCall(StartFile,
|
||||
{Builder.CreateGlobalStringPtr(FilenameGcda),
|
||||
Builder.CreateGlobalStringPtr(ReversedVersion),
|
||||
Builder.getInt32(CfgChecksum));
|
||||
Builder.getInt32(CfgChecksum)});
|
||||
for (unsigned j = 0, e = CountersBySP.size(); j != e; ++j) {
|
||||
auto *SP = cast_or_null<DISubprogram>(CountersBySP[j].second);
|
||||
uint32_t FuncChecksum = Funcs.empty() ? 0 : Funcs[j]->getFuncChecksum();
|
||||
Builder.CreateCall5(
|
||||
EmitFunction, Builder.getInt32(j),
|
||||
Options.FunctionNamesInData ?
|
||||
Builder.CreateGlobalStringPtr(getFunctionName(SP)) :
|
||||
Constant::getNullValue(Builder.getInt8PtrTy()),
|
||||
Builder.CreateCall(
|
||||
EmitFunction,
|
||||
{Builder.getInt32(j),
|
||||
Options.FunctionNamesInData
|
||||
? Builder.CreateGlobalStringPtr(getFunctionName(SP))
|
||||
: Constant::getNullValue(Builder.getInt8PtrTy()),
|
||||
Builder.getInt32(FuncChecksum),
|
||||
Builder.getInt8(Options.UseCfgChecksum),
|
||||
Builder.getInt32(CfgChecksum));
|
||||
Builder.getInt32(CfgChecksum)});
|
||||
|
||||
GlobalVariable *GV = CountersBySP[j].first;
|
||||
unsigned Arcs =
|
||||
cast<ArrayType>(GV->getType()->getElementType())->getNumElements();
|
||||
Builder.CreateCall2(EmitArcs,
|
||||
Builder.getInt32(Arcs),
|
||||
Builder.CreateConstGEP2_64(GV, 0, 0));
|
||||
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
|
||||
|
@ -348,7 +348,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);
|
||||
|
@ -673,9 +673,9 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
|
||||
Value *Fn = MS.MaybeStoreOriginFn[SizeIndex];
|
||||
Value *ConvertedShadow2 = IRB.CreateZExt(
|
||||
ConvertedShadow, IRB.getIntNTy(8 * (1 << SizeIndex)));
|
||||
IRB.CreateCall3(Fn, ConvertedShadow2,
|
||||
IRB.CreateCall(Fn, {ConvertedShadow2,
|
||||
IRB.CreatePointerCast(Addr, IRB.getInt8PtrTy()),
|
||||
Origin);
|
||||
Origin});
|
||||
} else {
|
||||
Value *Cmp = IRB.CreateICmpNE(
|
||||
ConvertedShadow, getCleanShadow(ConvertedShadow), "_mscmp");
|
||||
@ -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.
|
||||
@ -745,9 +745,9 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
|
||||
Value *Fn = MS.MaybeWarningFn[SizeIndex];
|
||||
Value *ConvertedShadow2 =
|
||||
IRB.CreateZExt(ConvertedShadow, IRB.getIntNTy(8 * (1 << SizeIndex)));
|
||||
IRB.CreateCall2(Fn, ConvertedShadow2, MS.TrackOrigins && Origin
|
||||
IRB.CreateCall(Fn, {ConvertedShadow2, MS.TrackOrigins && Origin
|
||||
? Origin
|
||||
: (Value *)IRB.getInt32(0));
|
||||
: (Value *)IRB.getInt32(0)});
|
||||
} else {
|
||||
Value *Cmp = IRB.CreateICmpNE(ConvertedShadow,
|
||||
getCleanShadow(ConvertedShadow), "_mscmp");
|
||||
@ -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");
|
||||
}
|
||||
}
|
||||
@ -1802,11 +1802,11 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
|
||||
/// Similar situation exists for memcpy and memset.
|
||||
void visitMemMoveInst(MemMoveInst &I) {
|
||||
IRBuilder<> IRB(&I);
|
||||
IRB.CreateCall3(
|
||||
IRB.CreateCall(
|
||||
MS.MemmoveFn,
|
||||
IRB.CreatePointerCast(I.getArgOperand(0), IRB.getInt8PtrTy()),
|
||||
{IRB.CreatePointerCast(I.getArgOperand(0), IRB.getInt8PtrTy()),
|
||||
IRB.CreatePointerCast(I.getArgOperand(1), IRB.getInt8PtrTy()),
|
||||
IRB.CreateIntCast(I.getArgOperand(2), MS.IntptrTy, false));
|
||||
IRB.CreateIntCast(I.getArgOperand(2), MS.IntptrTy, false)});
|
||||
I.eraseFromParent();
|
||||
}
|
||||
|
||||
@ -1816,22 +1816,22 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
|
||||
// alignment.
|
||||
void visitMemCpyInst(MemCpyInst &I) {
|
||||
IRBuilder<> IRB(&I);
|
||||
IRB.CreateCall3(
|
||||
IRB.CreateCall(
|
||||
MS.MemcpyFn,
|
||||
IRB.CreatePointerCast(I.getArgOperand(0), IRB.getInt8PtrTy()),
|
||||
{IRB.CreatePointerCast(I.getArgOperand(0), IRB.getInt8PtrTy()),
|
||||
IRB.CreatePointerCast(I.getArgOperand(1), IRB.getInt8PtrTy()),
|
||||
IRB.CreateIntCast(I.getArgOperand(2), MS.IntptrTy, false));
|
||||
IRB.CreateIntCast(I.getArgOperand(2), MS.IntptrTy, false)});
|
||||
I.eraseFromParent();
|
||||
}
|
||||
|
||||
// Same as memcpy.
|
||||
void visitMemSetInst(MemSetInst &I) {
|
||||
IRBuilder<> IRB(&I);
|
||||
IRB.CreateCall3(
|
||||
IRB.CreateCall(
|
||||
MS.MemsetFn,
|
||||
IRB.CreatePointerCast(I.getArgOperand(0), IRB.getInt8PtrTy()),
|
||||
{IRB.CreatePointerCast(I.getArgOperand(0), IRB.getInt8PtrTy()),
|
||||
IRB.CreateIntCast(I.getArgOperand(1), IRB.getInt32Ty(), false),
|
||||
IRB.CreateIntCast(I.getArgOperand(2), MS.IntptrTy, false));
|
||||
IRB.CreateIntCast(I.getArgOperand(2), MS.IntptrTy, false)});
|
||||
I.eraseFromParent();
|
||||
}
|
||||
|
||||
@ -2112,8 +2112,8 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
|
||||
: Lower64ShadowExtend(IRB, S2, getShadowTy(&I));
|
||||
Value *V1 = I.getOperand(0);
|
||||
Value *V2 = I.getOperand(1);
|
||||
Value *Shift = IRB.CreateCall2(I.getCalledValue(),
|
||||
IRB.CreateBitCast(S1, V1->getType()), V2);
|
||||
Value *Shift = IRB.CreateCall(I.getCalledValue(),
|
||||
{IRB.CreateBitCast(S1, V1->getType()), V2});
|
||||
Shift = IRB.CreateBitCast(Shift, getShadowTy(&I));
|
||||
setShadow(&I, IRB.CreateOr(Shift, S2Conv));
|
||||
setOriginForNaryOp(I);
|
||||
@ -2193,7 +2193,8 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
|
||||
Function *ShadowFn = Intrinsic::getDeclaration(
|
||||
F.getParent(), getSignedPackIntrinsic(I.getIntrinsicID()));
|
||||
|
||||
Value *S = IRB.CreateCall2(ShadowFn, S1_ext, S2_ext, "_msprop_vector_pack");
|
||||
Value *S =
|
||||
IRB.CreateCall(ShadowFn, {S1_ext, S2_ext}, "_msprop_vector_pack");
|
||||
if (isX86_MMX) S = IRB.CreateBitCast(S, getShadowTy(&I));
|
||||
setShadow(&I, S);
|
||||
setOriginForNaryOp(I);
|
||||
@ -2544,9 +2545,9 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
|
||||
const DataLayout &DL = F.getParent()->getDataLayout();
|
||||
uint64_t Size = DL.getTypeAllocSize(I.getAllocatedType());
|
||||
if (PoisonStack && ClPoisonStackWithCall) {
|
||||
IRB.CreateCall2(MS.MsanPoisonStackFn,
|
||||
IRB.CreatePointerCast(&I, IRB.getInt8PtrTy()),
|
||||
ConstantInt::get(MS.IntptrTy, Size));
|
||||
IRB.CreateCall(MS.MsanPoisonStackFn,
|
||||
{IRB.CreatePointerCast(&I, IRB.getInt8PtrTy()),
|
||||
ConstantInt::get(MS.IntptrTy, Size)});
|
||||
} else {
|
||||
Value *ShadowBase = getShadowPtr(&I, Type::getInt8PtrTy(*MS.C), IRB);
|
||||
Value *PoisonValue = IRB.getInt8(PoisonStack ? ClPoisonStackPattern : 0);
|
||||
@ -2566,11 +2567,11 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
|
||||
createPrivateNonConstGlobalForString(*F.getParent(),
|
||||
StackDescription.str());
|
||||
|
||||
IRB.CreateCall4(MS.MsanSetAllocaOrigin4Fn,
|
||||
IRB.CreatePointerCast(&I, IRB.getInt8PtrTy()),
|
||||
IRB.CreateCall(MS.MsanSetAllocaOrigin4Fn,
|
||||
{IRB.CreatePointerCast(&I, IRB.getInt8PtrTy()),
|
||||
ConstantInt::get(MS.IntptrTy, Size),
|
||||
IRB.CreatePointerCast(Descr, IRB.getInt8PtrTy()),
|
||||
IRB.CreatePointerCast(&F, MS.IntptrTy));
|
||||
IRB.CreatePointerCast(&F, MS.IntptrTy)});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -341,9 +341,9 @@ void SanitizerCoverageModule::InjectCoverageForIndirectCalls(
|
||||
*F.getParent(), Ty, false, GlobalValue::PrivateLinkage,
|
||||
Constant::getNullValue(Ty), "__sancov_gen_callee_cache");
|
||||
CalleeCache->setAlignment(kCacheAlignment);
|
||||
IRB.CreateCall2(SanCovIndirCallFunction,
|
||||
IRB.CreatePointerCast(Callee, IntptrTy),
|
||||
IRB.CreatePointerCast(CalleeCache, IntptrTy));
|
||||
IRB.CreateCall(SanCovIndirCallFunction,
|
||||
{IRB.CreatePointerCast(Callee, IntptrTy),
|
||||
IRB.CreatePointerCast(CalleeCache, IntptrTy)});
|
||||
}
|
||||
}
|
||||
|
||||
@ -357,11 +357,11 @@ void SanitizerCoverageModule::InjectTraceForCmp(
|
||||
if (!A0->getType()->isIntegerTy()) continue;
|
||||
uint64_t TypeSize = DL->getTypeStoreSizeInBits(A0->getType());
|
||||
// __sanitizer_cov_trace_cmp((type_size << 32) | predicate, A0, A1);
|
||||
IRB.CreateCall3(
|
||||
IRB.CreateCall(
|
||||
SanCovTraceCmpFunction,
|
||||
ConstantInt::get(Int64Ty, (TypeSize << 32) | ICMP->getPredicate()),
|
||||
{ConstantInt::get(Int64Ty, (TypeSize << 32) | ICMP->getPredicate()),
|
||||
IRB.CreateIntCast(A0, Int64Ty, true),
|
||||
IRB.CreateIntCast(A1, Int64Ty, true));
|
||||
IRB.CreateIntCast(A1, Int64Ty, true)});
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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) {
|
||||
|
@ -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;
|
||||
}
|
||||
@ -427,9 +427,9 @@ bool ThreadSanitizer::instrumentLoadOrStore(Instruction *I,
|
||||
if (StoredValue->getType()->isIntegerTy())
|
||||
StoredValue = IRB.CreateIntToPtr(StoredValue, IRB.getInt8PtrTy());
|
||||
// Call TsanVptrUpdate.
|
||||
IRB.CreateCall2(TsanVptrUpdate,
|
||||
IRB.CreatePointerCast(Addr, IRB.getInt8PtrTy()),
|
||||
IRB.CreatePointerCast(StoredValue, IRB.getInt8PtrTy()));
|
||||
IRB.CreateCall(TsanVptrUpdate,
|
||||
{IRB.CreatePointerCast(Addr, IRB.getInt8PtrTy()),
|
||||
IRB.CreatePointerCast(StoredValue, IRB.getInt8PtrTy())});
|
||||
NumInstrumentedVtableWrites++;
|
||||
return true;
|
||||
}
|
||||
@ -481,16 +481,18 @@ static ConstantInt *createOrdering(IRBuilder<> *IRB, AtomicOrdering ord) {
|
||||
bool ThreadSanitizer::instrumentMemIntrinsic(Instruction *I) {
|
||||
IRBuilder<> IRB(I);
|
||||
if (MemSetInst *M = dyn_cast<MemSetInst>(I)) {
|
||||
IRB.CreateCall3(MemsetFn,
|
||||
IRB.CreatePointerCast(M->getArgOperand(0), IRB.getInt8PtrTy()),
|
||||
IRB.CreateCall(
|
||||
MemsetFn,
|
||||
{IRB.CreatePointerCast(M->getArgOperand(0), IRB.getInt8PtrTy()),
|
||||
IRB.CreateIntCast(M->getArgOperand(1), IRB.getInt32Ty(), false),
|
||||
IRB.CreateIntCast(M->getArgOperand(2), IntptrTy, false));
|
||||
IRB.CreateIntCast(M->getArgOperand(2), IntptrTy, false)});
|
||||
I->eraseFromParent();
|
||||
} else if (MemTransferInst *M = dyn_cast<MemTransferInst>(I)) {
|
||||
IRB.CreateCall3(isa<MemCpyInst>(M) ? MemcpyFn : MemmoveFn,
|
||||
IRB.CreatePointerCast(M->getArgOperand(0), IRB.getInt8PtrTy()),
|
||||
IRB.CreateCall(
|
||||
isa<MemCpyInst>(M) ? MemcpyFn : MemmoveFn,
|
||||
{IRB.CreatePointerCast(M->getArgOperand(0), IRB.getInt8PtrTy()),
|
||||
IRB.CreatePointerCast(M->getArgOperand(1), IRB.getInt8PtrTy()),
|
||||
IRB.CreateIntCast(M->getArgOperand(2), IntptrTy, false));
|
||||
IRB.CreateIntCast(M->getArgOperand(2), IntptrTy, false)});
|
||||
I->eraseFromParent();
|
||||
}
|
||||
return false;
|
||||
|
@ -1001,7 +1001,7 @@ processLoopStridedStore(Value *DestPtr, unsigned StoreSize,
|
||||
GV->setUnnamedAddr(true); // Ok to merge these.
|
||||
GV->setAlignment(16);
|
||||
Value *PatternPtr = ConstantExpr::getBitCast(GV, Int8PtrTy);
|
||||
NewCall = Builder.CreateCall3(MSP, BasePtr, PatternPtr, NumBytes);
|
||||
NewCall = Builder.CreateCall(MSP, {BasePtr, PatternPtr, NumBytes});
|
||||
}
|
||||
|
||||
DEBUG(dbgs() << " Formed memset: " << *NewCall << "\n"
|
||||
|
@ -1118,8 +1118,8 @@ static void CreateGCRelocates(ArrayRef<llvm::Value *> LiveVariables,
|
||||
LiveStart + find_index(LiveVariables, LiveVariables[i]));
|
||||
|
||||
// only specify a debug name if we can give a useful one
|
||||
Value *Reloc = Builder.CreateCall3(
|
||||
GCRelocateDecl, StatepointToken, BaseIdx, LiveIdx,
|
||||
Value *Reloc = Builder.CreateCall(
|
||||
GCRelocateDecl, {StatepointToken, BaseIdx, LiveIdx},
|
||||
LiveVariables[i]->hasName() ? LiveVariables[i]->getName() + ".relocated"
|
||||
: "");
|
||||
// Trick CodeGen into thinking there are lots of free registers at this
|
||||
|
@ -74,7 +74,7 @@ Value *llvm::EmitStrNLen(Value *Ptr, Value *MaxLen, IRBuilder<> &B,
|
||||
M->getOrInsertFunction("strnlen", AttributeSet::get(M->getContext(), AS),
|
||||
DL.getIntPtrType(Context), B.getInt8PtrTy(),
|
||||
DL.getIntPtrType(Context), nullptr);
|
||||
CallInst *CI = B.CreateCall2(StrNLen, CastToCStr(Ptr, B), MaxLen, "strnlen");
|
||||
CallInst *CI = B.CreateCall(StrNLen, {CastToCStr(Ptr, B), MaxLen}, "strnlen");
|
||||
if (const Function *F = dyn_cast<Function>(StrNLen->stripPointerCasts()))
|
||||
CI->setCallingConv(F->getCallingConv());
|
||||
|
||||
@ -100,8 +100,8 @@ Value *llvm::EmitStrChr(Value *Ptr, char C, IRBuilder<> &B,
|
||||
AttributeSet::get(M->getContext(),
|
||||
AS),
|
||||
I8Ptr, I8Ptr, I32Ty, nullptr);
|
||||
CallInst *CI = B.CreateCall2(StrChr, CastToCStr(Ptr, B),
|
||||
ConstantInt::get(I32Ty, C), "strchr");
|
||||
CallInst *CI = B.CreateCall(
|
||||
StrChr, {CastToCStr(Ptr, B), ConstantInt::get(I32Ty, C)}, "strchr");
|
||||
if (const Function *F = dyn_cast<Function>(StrChr->stripPointerCasts()))
|
||||
CI->setCallingConv(F->getCallingConv());
|
||||
return CI;
|
||||
@ -124,8 +124,8 @@ Value *llvm::EmitStrNCmp(Value *Ptr1, Value *Ptr2, Value *Len, IRBuilder<> &B,
|
||||
Value *StrNCmp = M->getOrInsertFunction(
|
||||
"strncmp", AttributeSet::get(M->getContext(), AS), B.getInt32Ty(),
|
||||
B.getInt8PtrTy(), B.getInt8PtrTy(), DL.getIntPtrType(Context), nullptr);
|
||||
CallInst *CI = B.CreateCall3(StrNCmp, CastToCStr(Ptr1, B),
|
||||
CastToCStr(Ptr2, B), Len, "strncmp");
|
||||
CallInst *CI = B.CreateCall(
|
||||
StrNCmp, {CastToCStr(Ptr1, B), CastToCStr(Ptr2, B), Len}, "strncmp");
|
||||
|
||||
if (const Function *F = dyn_cast<Function>(StrNCmp->stripPointerCasts()))
|
||||
CI->setCallingConv(F->getCallingConv());
|
||||
@ -149,8 +149,8 @@ Value *llvm::EmitStrCpy(Value *Dst, Value *Src, IRBuilder<> &B,
|
||||
Value *StrCpy = M->getOrInsertFunction(Name,
|
||||
AttributeSet::get(M->getContext(), AS),
|
||||
I8Ptr, I8Ptr, I8Ptr, nullptr);
|
||||
CallInst *CI = B.CreateCall2(StrCpy, CastToCStr(Dst, B), CastToCStr(Src, B),
|
||||
Name);
|
||||
CallInst *CI =
|
||||
B.CreateCall(StrCpy, {CastToCStr(Dst, B), CastToCStr(Src, B)}, Name);
|
||||
if (const Function *F = dyn_cast<Function>(StrCpy->stripPointerCasts()))
|
||||
CI->setCallingConv(F->getCallingConv());
|
||||
return CI;
|
||||
@ -174,8 +174,8 @@ Value *llvm::EmitStrNCpy(Value *Dst, Value *Src, Value *Len, IRBuilder<> &B,
|
||||
AS),
|
||||
I8Ptr, I8Ptr, I8Ptr,
|
||||
Len->getType(), nullptr);
|
||||
CallInst *CI = B.CreateCall3(StrNCpy, CastToCStr(Dst, B), CastToCStr(Src, B),
|
||||
Len, "strncpy");
|
||||
CallInst *CI = B.CreateCall(
|
||||
StrNCpy, {CastToCStr(Dst, B), CastToCStr(Src, B), Len}, "strncpy");
|
||||
if (const Function *F = dyn_cast<Function>(StrNCpy->stripPointerCasts()))
|
||||
CI->setCallingConv(F->getCallingConv());
|
||||
return CI;
|
||||
@ -201,7 +201,7 @@ Value *llvm::EmitMemCpyChk(Value *Dst, Value *Src, Value *Len, Value *ObjSize,
|
||||
DL.getIntPtrType(Context), nullptr);
|
||||
Dst = CastToCStr(Dst, B);
|
||||
Src = CastToCStr(Src, B);
|
||||
CallInst *CI = B.CreateCall4(MemCpy, Dst, Src, Len, ObjSize);
|
||||
CallInst *CI = B.CreateCall(MemCpy, {Dst, Src, Len, ObjSize});
|
||||
if (const Function *F = dyn_cast<Function>(MemCpy->stripPointerCasts()))
|
||||
CI->setCallingConv(F->getCallingConv());
|
||||
return CI;
|
||||
@ -222,7 +222,7 @@ Value *llvm::EmitMemChr(Value *Ptr, Value *Val, Value *Len, IRBuilder<> &B,
|
||||
Value *MemChr = M->getOrInsertFunction(
|
||||
"memchr", AttributeSet::get(M->getContext(), AS), B.getInt8PtrTy(),
|
||||
B.getInt8PtrTy(), B.getInt32Ty(), DL.getIntPtrType(Context), nullptr);
|
||||
CallInst *CI = B.CreateCall3(MemChr, CastToCStr(Ptr, B), Val, Len, "memchr");
|
||||
CallInst *CI = B.CreateCall(MemChr, {CastToCStr(Ptr, B), Val, Len}, "memchr");
|
||||
|
||||
if (const Function *F = dyn_cast<Function>(MemChr->stripPointerCasts()))
|
||||
CI->setCallingConv(F->getCallingConv());
|
||||
@ -247,8 +247,8 @@ Value *llvm::EmitMemCmp(Value *Ptr1, Value *Ptr2, Value *Len, IRBuilder<> &B,
|
||||
Value *MemCmp = M->getOrInsertFunction(
|
||||
"memcmp", AttributeSet::get(M->getContext(), AS), B.getInt32Ty(),
|
||||
B.getInt8PtrTy(), B.getInt8PtrTy(), DL.getIntPtrType(Context), nullptr);
|
||||
CallInst *CI = B.CreateCall3(MemCmp, CastToCStr(Ptr1, B), CastToCStr(Ptr2, B),
|
||||
Len, "memcmp");
|
||||
CallInst *CI = B.CreateCall(
|
||||
MemCmp, {CastToCStr(Ptr1, B), CastToCStr(Ptr2, B), Len}, "memcmp");
|
||||
|
||||
if (const Function *F = dyn_cast<Function>(MemCmp->stripPointerCasts()))
|
||||
CI->setCallingConv(F->getCallingConv());
|
||||
@ -304,7 +304,7 @@ Value *llvm::EmitBinaryFloatFnCall(Value *Op1, Value *Op2, StringRef Name,
|
||||
Module *M = B.GetInsertBlock()->getParent()->getParent();
|
||||
Value *Callee = M->getOrInsertFunction(Name, Op1->getType(),
|
||||
Op1->getType(), Op2->getType(), nullptr);
|
||||
CallInst *CI = B.CreateCall2(Callee, Op1, Op2, Name);
|
||||
CallInst *CI = B.CreateCall(Callee, {Op1, Op2}, Name);
|
||||
CI->setAttributes(Attrs);
|
||||
if (const Function *F = dyn_cast<Function>(Callee->stripPointerCasts()))
|
||||
CI->setCallingConv(F->getCallingConv());
|
||||
@ -384,7 +384,7 @@ Value *llvm::EmitFPutC(Value *Char, Value *File, IRBuilder<> &B,
|
||||
File->getType(), nullptr);
|
||||
Char = B.CreateIntCast(Char, B.getInt32Ty(), /*isSigned*/true,
|
||||
"chari");
|
||||
CallInst *CI = B.CreateCall2(F, Char, File, "fputc");
|
||||
CallInst *CI = B.CreateCall(F, {Char, File}, "fputc");
|
||||
|
||||
if (const Function *Fn = dyn_cast<Function>(F->stripPointerCasts()))
|
||||
CI->setCallingConv(Fn->getCallingConv());
|
||||
@ -416,7 +416,7 @@ Value *llvm::EmitFPutS(Value *Str, Value *File, IRBuilder<> &B,
|
||||
F = M->getOrInsertFunction(FPutsName, B.getInt32Ty(),
|
||||
B.getInt8PtrTy(),
|
||||
File->getType(), nullptr);
|
||||
CallInst *CI = B.CreateCall2(F, CastToCStr(Str, B), File, "fputs");
|
||||
CallInst *CI = B.CreateCall(F, {CastToCStr(Str, B), File}, "fputs");
|
||||
|
||||
if (const Function *Fn = dyn_cast<Function>(F->stripPointerCasts()))
|
||||
CI->setCallingConv(Fn->getCallingConv());
|
||||
@ -450,8 +450,8 @@ Value *llvm::EmitFWrite(Value *Ptr, Value *Size, Value *File, IRBuilder<> &B,
|
||||
DL.getIntPtrType(Context), File->getType(),
|
||||
nullptr);
|
||||
CallInst *CI =
|
||||
B.CreateCall4(F, CastToCStr(Ptr, B), Size,
|
||||
ConstantInt::get(DL.getIntPtrType(Context), 1), File);
|
||||
B.CreateCall(F, {CastToCStr(Ptr, B), Size,
|
||||
ConstantInt::get(DL.getIntPtrType(Context), 1), File});
|
||||
|
||||
if (const Function *Fn = dyn_cast<Function>(F->stripPointerCasts()))
|
||||
CI->setCallingConv(Fn->getCallingConv());
|
||||
|
@ -1202,7 +1202,7 @@ bool llvm::InlineFunction(CallSite CS, InlineFunctionInfo &IFI,
|
||||
|
||||
// Insert the llvm.stacksave.
|
||||
CallInst *SavedPtr = IRBuilder<>(FirstNewBlock, FirstNewBlock->begin())
|
||||
.CreateCall(StackSave, "savedstack");
|
||||
.CreateCall(StackSave, {}, "savedstack");
|
||||
|
||||
// Insert a call to llvm.stackrestore before any return instructions in the
|
||||
// inlined function.
|
||||
|
@ -252,8 +252,8 @@ static Value *generateUnsignedDivisionCode(Value *Dividend, Value *Divisor,
|
||||
Value *Ret0_1 = Builder.CreateICmpEQ(Divisor, Zero);
|
||||
Value *Ret0_2 = Builder.CreateICmpEQ(Dividend, Zero);
|
||||
Value *Ret0_3 = Builder.CreateOr(Ret0_1, Ret0_2);
|
||||
Value *Tmp0 = Builder.CreateCall2(CTLZ, Divisor, True);
|
||||
Value *Tmp1 = Builder.CreateCall2(CTLZ, Dividend, True);
|
||||
Value *Tmp0 = Builder.CreateCall(CTLZ, {Divisor, True});
|
||||
Value *Tmp1 = Builder.CreateCall(CTLZ, {Dividend, True});
|
||||
Value *SR = Builder.CreateSub(Tmp0, Tmp1);
|
||||
Value *Ret0_4 = Builder.CreateICmpUGT(SR, MSB);
|
||||
Value *Ret0 = Builder.CreateOr(Ret0_3, Ret0_4);
|
||||
|
@ -1150,7 +1150,7 @@ Value *LibCallSimplifier::optimizeExp2(CallInst *CI, IRBuilder<> &B) {
|
||||
Value *Callee =
|
||||
M->getOrInsertFunction(TLI->getName(LdExp), Op->getType(),
|
||||
Op->getType(), B.getInt32Ty(), nullptr);
|
||||
CallInst *CI = B.CreateCall2(Callee, One, LdExpArg);
|
||||
CallInst *CI = B.CreateCall(Callee, {One, LdExpArg});
|
||||
if (const Function *F = dyn_cast<Function>(Callee->stripPointerCasts()))
|
||||
CI->setCallingConv(F->getCallingConv());
|
||||
|
||||
@ -1436,7 +1436,7 @@ Value *LibCallSimplifier::optimizeFFS(CallInst *CI, IRBuilder<> &B) {
|
||||
Type *ArgType = Op->getType();
|
||||
Value *F =
|
||||
Intrinsic::getDeclaration(Callee->getParent(), Intrinsic::cttz, ArgType);
|
||||
Value *V = B.CreateCall2(F, Op, B.getFalse(), "cttz");
|
||||
Value *V = B.CreateCall(F, {Op, B.getFalse()}, "cttz");
|
||||
V = B.CreateAdd(V, ConstantInt::get(V->getType(), 1));
|
||||
V = B.CreateIntCast(V, B.getInt32Ty(), false);
|
||||
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user