<div dir="ltr">Serge,<div><br></div><div>You've forgot to update documentation for <span style="font-size:12.8px">getOrInsertFunction() </span>in <span style="font-size:12.8px">llvm/trunk/include/llvm/IR/</span><wbr style="font-size:12.8px"><span style="font-size:12.8px">Module.h to reflect that it doesn't require null-trerminated list anymore. Currently it specifically states that it requires null terminated list.</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">Dmitry.</span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Apr 17, 2017 at 12:55 PM, David Blaikie via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_quote"><div><div class="h5"><div dir="ltr">On Tue, Apr 11, 2017 at 8:13 AM Serge Guelton via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: serge_sans_paille<br>
Date: Tue Apr 11 10:01:18 2017<br>
New Revision: 299949<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=299949&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project?rev=299949&view=rev</a><br>
Log:<br>
Module::getOrInsertFunction is using C-style vararg instead of variadic templates.<br>
<br>
>From a user prospective, it forces the use of an annoying nullptr to mark the end of the vararg, and there's not type checking on the arguments.<br>
The variadic template is an obvious solution to both issues.<br>
<br>
Differential Revision: <a href="https://reviews.llvm.org/D31070" rel="noreferrer" target="_blank">https://reviews.llvm.org/<wbr>D31070</a><br>
<br>
<br>
Modified:<br>
llvm/trunk/examples/BrainF/<wbr>BrainF.cpp<br>
llvm/trunk/examples/BrainF/<wbr>BrainFDriver.cpp<br>
llvm/trunk/examples/Fibonacci/<wbr>fibonacci.cpp<br>
llvm/trunk/examples/<wbr>HowToUseJIT/HowToUseJIT.cpp<br>
llvm/trunk/examples/<wbr>ParallelJIT/ParallelJIT.cpp<br>
llvm/trunk/include/llvm/IR/<wbr>Module.h<br>
llvm/trunk/lib/CodeGen/<wbr>CountingFunctionInserter.cpp<br>
llvm/trunk/lib/CodeGen/<wbr>IntrinsicLowering.cpp<br>
llvm/trunk/lib/CodeGen/<wbr>MachineOutliner.cpp<br>
llvm/trunk/lib/CodeGen/<wbr>SafeStack.cpp<br>
llvm/trunk/lib/CodeGen/<wbr>SjLjEHPrepare.cpp<br>
llvm/trunk/lib/CodeGen/<wbr>StackProtector.cpp<br>
llvm/trunk/lib/CodeGen/<wbr>TargetLoweringBase.cpp<br>
llvm/trunk/lib/IR/<wbr>Instructions.cpp<br>
llvm/trunk/lib/IR/Module.cpp<br>
llvm/trunk/lib/Target/Hexagon/<wbr>HexagonLoopIdiomRecognition.<wbr>cpp<br>
llvm/trunk/lib/Target/Mips/<wbr>Mips16HardFloat.cpp<br>
llvm/trunk/lib/Target/X86/<wbr>X86ISelLowering.cpp<br>
llvm/trunk/lib/Transforms/IPO/<wbr>CrossDSOCFI.cpp<br>
llvm/trunk/lib/Transforms/IPO/<wbr>WholeProgramDevirt.cpp<br>
llvm/trunk/lib/Transforms/<wbr>Instrumentation/<wbr>AddressSanitizer.cpp<br>
llvm/trunk/lib/Transforms/<wbr>Instrumentation/<wbr>EfficiencySanitizer.cpp<br>
llvm/trunk/lib/Transforms/<wbr>Instrumentation/<wbr>MemorySanitizer.cpp<br>
llvm/trunk/lib/Transforms/<wbr>Instrumentation/<wbr>SanitizerCoverage.cpp<br>
llvm/trunk/lib/Transforms/<wbr>Instrumentation/<wbr>ThreadSanitizer.cpp<br>
llvm/trunk/lib/Transforms/<wbr>Scalar/LoopIdiomRecognize.cpp<br>
llvm/trunk/lib/Transforms/<wbr>Utils/BuildLibCalls.cpp<br>
llvm/trunk/lib/Transforms/<wbr>Utils/SimplifyLibCalls.cpp<br>
llvm/trunk/tools/bugpoint/<wbr>Miscompilation.cpp<br>
llvm/trunk/tools/lli/lli.cpp<br>
<br>
Modified: llvm/trunk/examples/BrainF/<wbr>BrainF.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/BrainF/BrainF.cpp?rev=299949&r1=299948&r2=299949&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/examples/<wbr>BrainF/BrainF.cpp?rev=299949&<wbr>r1=299948&r2=299949&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/examples/BrainF/<wbr>BrainF.cpp (original)<br>
+++ llvm/trunk/examples/BrainF/<wbr>BrainF.cpp Tue Apr 11 10:01:18 2017<br>
@@ -74,18 +74,18 @@ void BrainF::header(LLVMContext& C) {<br>
<br>
//declare i32 @getchar()<br>
getchar_func = cast<Function>(module-><br>
- getOrInsertFunction("getchar", IntegerType::getInt32Ty(C), NULL));<br>
+ getOrInsertFunction("getchar", IntegerType::getInt32Ty(C)));<br>
<br>
//declare i32 @putchar(i32)<br>
putchar_func = cast<Function>(module-><br>
getOrInsertFunction("putchar"<wbr>, IntegerType::getInt32Ty(C),<br>
- IntegerType::getInt32Ty(C), NULL));<br>
+ IntegerType::getInt32Ty(C)));<br>
<br>
//Function header<br>
<br>
//define void @brainf()<br>
brainf_func = cast<Function>(module-><br>
- getOrInsertFunction("brainf", Type::getVoidTy(C), NULL));<br>
+ getOrInsertFunction("brainf", Type::getVoidTy(C)));<br>
<br>
builder = new IRBuilder<>(BasicBlock::<wbr>Create(C, label, brainf_func));<br>
<br>
@@ -156,7 +156,7 @@ void BrainF::header(LLVMContext& C) {<br>
//declare i32 @puts(i8 *)<br>
Function *puts_func = cast<Function>(module-><br>
getOrInsertFunction("puts", IntegerType::getInt32Ty(C),<br>
- PointerType::getUnqual(<wbr>IntegerType::getInt8Ty(C)), NULL));<br>
+ PointerType::getUnqual(<wbr>IntegerType::getInt8Ty(C))));<br>
<br>
//brainf.aberror:<br>
aberrorbb = BasicBlock::Create(C, label, brainf_func);<br>
<br>
Modified: llvm/trunk/examples/BrainF/<wbr>BrainFDriver.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/BrainF/BrainFDriver.cpp?rev=299949&r1=299948&r2=299949&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/examples/<wbr>BrainF/BrainFDriver.cpp?rev=<wbr>299949&r1=299948&r2=299949&<wbr>view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/examples/BrainF/<wbr>BrainFDriver.cpp (original)<br>
+++ llvm/trunk/examples/BrainF/<wbr>BrainFDriver.cpp Tue Apr 11 10:01:18 2017<br>
@@ -77,7 +77,7 @@ void addMainFunction(Module *mod) {<br>
getOrInsertFunction("main", IntegerType::getInt32Ty(mod-><wbr>getContext()),<br>
IntegerType::getInt32Ty(mod-><wbr>getContext()),<br>
PointerType::getUnqual(<wbr>PointerType::getUnqual(<br>
- IntegerType::getInt8Ty(mod-><wbr>getContext()))), NULL));<br>
+ IntegerType::getInt8Ty(mod-><wbr>getContext())))));<br>
{<br>
Function::arg_iterator args = main_func->arg_begin();<br>
Value *arg_0 = &*args++;<br>
<br>
Modified: llvm/trunk/examples/Fibonacci/<wbr>fibonacci.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Fibonacci/fibonacci.cpp?rev=299949&r1=299948&r2=299949&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/examples/<wbr>Fibonacci/fibonacci.cpp?rev=<wbr>299949&r1=299948&r2=299949&<wbr>view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/examples/Fibonacci/<wbr>fibonacci.cpp (original)<br>
+++ llvm/trunk/examples/Fibonacci/<wbr>fibonacci.cpp Tue Apr 11 10:01:18 2017<br>
@@ -54,8 +54,7 @@ static Function *CreateFibFunction(Modul<br>
// to return an int and take an int parameter.<br>
Function *FibF =<br>
cast<Function>(M-><wbr>getOrInsertFunction("fib", Type::getInt32Ty(Context),<br>
- Type::getInt32Ty(Context),<br>
- nullptr));<br>
+ Type::getInt32Ty(Context)));<br>
<br>
// Add a basic block to the function.<br>
BasicBlock *BB = BasicBlock::Create(Context, "EntryBlock", FibF);<br>
<br>
Modified: llvm/trunk/examples/<wbr>HowToUseJIT/HowToUseJIT.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/HowToUseJIT/HowToUseJIT.cpp?rev=299949&r1=299948&r2=299949&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/examples/<wbr>HowToUseJIT/HowToUseJIT.cpp?<wbr>rev=299949&r1=299948&r2=<wbr>299949&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/examples/<wbr>HowToUseJIT/HowToUseJIT.cpp (original)<br>
+++ llvm/trunk/examples/<wbr>HowToUseJIT/HowToUseJIT.cpp Tue Apr 11 10:01:18 2017<br>
@@ -69,11 +69,9 @@ int main() {<br>
<br>
// Create the add1 function entry and insert this entry into module M. The<br>
// function will have a return type of "int" and take an argument of "int".<br>
- // The '0' terminates the list of argument types.<br>
Function *Add1F =<br>
cast<Function>(M-><wbr>getOrInsertFunction("add1", Type::getInt32Ty(Context),<br>
- Type::getInt32Ty(Context),<br>
- nullptr));<br>
+ Type::getInt32Ty(Context)));<br>
<br>
// Add a basic block to the function. As before, it automatically inserts<br>
// because of the last argument.<br>
@@ -102,8 +100,7 @@ int main() {<br>
// Now we're going to create function `foo', which returns an int and takes no<br>
// arguments.<br>
Function *FooF =<br>
- cast<Function>(M-><wbr>getOrInsertFunction("foo", Type::getInt32Ty(Context),<br>
- nullptr));<br>
+ cast<Function>(M-><wbr>getOrInsertFunction("foo", Type::getInt32Ty(Context)));<br>
<br>
// Add a basic block to the FooF function.<br>
BB = BasicBlock::Create(Context, "EntryBlock", FooF);<br>
<br>
Modified: llvm/trunk/examples/<wbr>ParallelJIT/ParallelJIT.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/ParallelJIT/ParallelJIT.cpp?rev=299949&r1=299948&r2=299949&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/examples/<wbr>ParallelJIT/ParallelJIT.cpp?<wbr>rev=299949&r1=299948&r2=<wbr>299949&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/examples/<wbr>ParallelJIT/ParallelJIT.cpp (original)<br>
+++ llvm/trunk/examples/<wbr>ParallelJIT/ParallelJIT.cpp Tue Apr 11 10:01:18 2017<br>
@@ -54,8 +54,7 @@ static Function* createAdd1(Module *M) {<br>
Function *Add1F =<br>
cast<Function>(M-><wbr>getOrInsertFunction("add1",<br>
Type::getInt32Ty(M-><wbr>getContext()),<br>
- Type::getInt32Ty(M-><wbr>getContext()),<br>
- nullptr));<br>
+ Type::getInt32Ty(M-><wbr>getContext())));<br>
<br>
// Add a basic block to the function. As before, it automatically inserts<br>
// because of the last argument.<br>
@@ -85,8 +84,7 @@ static Function *CreateFibFunction(Modul<br>
Function *FibF =<br>
cast<Function>(M-><wbr>getOrInsertFunction("fib",<br>
Type::getInt32Ty(M-><wbr>getContext()),<br>
- Type::getInt32Ty(M-><wbr>getContext()),<br>
- nullptr));<br>
+ Type::getInt32Ty(M-><wbr>getContext())));<br>
<br>
// Add a basic block to the function.<br>
BasicBlock *BB = BasicBlock::Create(M-><wbr>getContext(), "EntryBlock", FibF);<br>
<br>
Modified: llvm/trunk/include/llvm/IR/<wbr>Module.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/Module.h?rev=299949&r1=299948&r2=299949&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/include/<wbr>llvm/IR/Module.h?rev=299949&<wbr>r1=299948&r2=299949&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/include/llvm/IR/<wbr>Module.h (original)<br>
+++ llvm/trunk/include/llvm/IR/<wbr>Module.h Tue Apr 11 10:01:18 2017<br>
@@ -321,12 +321,22 @@ public:<br>
/// or a ConstantExpr BitCast of that type if the named function has a<br>
/// different type. This version of the method takes a null terminated list of<br>
/// function arguments, which makes it easier for clients to use.<br>
- Constant *getOrInsertFunction(StringRef Name, AttributeList AttributeList,<br>
- Type *RetTy, ...) LLVM_END_WITH_NULL;<br>
+ template<typename... ArgsTy><br>
+ Constant *getOrInsertFunction(StringRef Name,<br>
+ AttributeList AttributeList,<br>
+ Type *RetTy, ArgsTy... Args)<br>
+ {<br>
+ SmallVector<Type*, sizeof...(ArgsTy)> ArgTys{Args...};<br></blockquote><div><br></div></div></div><div>Is this ^ calling a ctor or list initialization? If it's a ctor, please write it with () rathert han {}, if it's list init, please write it with "T x = {}" syntax, I think? (goes similarly for other changes like this in this patch and another committed recently)</div><div><div class="h5"><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+ return getOrInsertFunction(Name,<br>
+ FunctionType::get(RetTy, ArgTys, false),<br>
+ AttributeList);<br>
+ }<br>
<br>
/// Same as above, but without the attributes.<br>
- Constant *getOrInsertFunction(StringRef Name, Type *RetTy, ...)<br>
- LLVM_END_WITH_NULL;<br>
+ template<typename... ArgsTy><br>
+ Constant *getOrInsertFunction(StringRef Name, Type *RetTy, ArgsTy... Args) {<br>
+ return getOrInsertFunction(Name, AttributeList{}, RetTy, Args...);<br>
+ }<br>
<br>
/// Look up the specified function in the module symbol table. If it does not<br>
/// exist, return null.<br>
<br>
Modified: llvm/trunk/lib/CodeGen/<wbr>CountingFunctionInserter.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/CountingFunctionInserter.cpp?rev=299949&r1=299948&r2=299949&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/lib/<wbr>CodeGen/<wbr>CountingFunctionInserter.cpp?<wbr>rev=299949&r1=299948&r2=<wbr>299949&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/lib/CodeGen/<wbr>CountingFunctionInserter.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/<wbr>CountingFunctionInserter.cpp Tue Apr 11 10:01:18 2017<br>
@@ -41,7 +41,7 @@ namespace {<br>
Type *VoidTy = Type::getVoidTy(F.getContext()<wbr>);<br>
Constant *CountingFn =<br>
F.getParent()-><wbr>getOrInsertFunction(<wbr>CountingFunctionName,<br>
- VoidTy, nullptr);<br>
+ VoidTy);<br>
CallInst::Create(CountingFn, "", &*F.begin()-><wbr>getFirstInsertionPt());<br>
return true;<br>
}<br>
<br>
Modified: llvm/trunk/lib/CodeGen/<wbr>IntrinsicLowering.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/IntrinsicLowering.cpp?rev=299949&r1=299948&r2=299949&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/lib/<wbr>CodeGen/IntrinsicLowering.cpp?<wbr>rev=299949&r1=299948&r2=<wbr>299949&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/lib/CodeGen/<wbr>IntrinsicLowering.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/<wbr>IntrinsicLowering.cpp Tue Apr 11 10:01:18 2017<br>
@@ -115,21 +115,21 @@ void IntrinsicLowering::<wbr>AddPrototypes(Mo<br>
Type::getInt8PtrTy(Context),<br>
Type::getInt8PtrTy(Context),<br>
Type::getInt8PtrTy(Context),<br>
- DL.getIntPtrType(Context), nullptr);<br>
+ DL.getIntPtrType(Context));<br>
break;<br>
case Intrinsic::memmove:<br>
M.getOrInsertFunction("<wbr>memmove",<br>
Type::getInt8PtrTy(Context),<br>
Type::getInt8PtrTy(Context),<br>
Type::getInt8PtrTy(Context),<br>
- DL.getIntPtrType(Context), nullptr);<br>
+ DL.getIntPtrType(Context));<br>
break;<br>
case Intrinsic::memset:<br>
M.getOrInsertFunction("<wbr>memset",<br>
Type::getInt8PtrTy(Context),<br>
Type::getInt8PtrTy(Context),<br>
Type::getInt32Ty(M.<wbr>getContext()),<br>
- DL.getIntPtrType(Context), nullptr);<br>
+ DL.getIntPtrType(Context));<br>
break;<br>
case Intrinsic::sqrt:<br>
EnsureFPIntrinsicsExist(M, F, "sqrtf", "sqrt", "sqrtl");<br>
<br>
Modified: llvm/trunk/lib/CodeGen/<wbr>MachineOutliner.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineOutliner.cpp?rev=299949&r1=299948&r2=299949&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/lib/<wbr>CodeGen/MachineOutliner.cpp?<wbr>rev=299949&r1=299948&r2=<wbr>299949&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/lib/CodeGen/<wbr>MachineOutliner.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/<wbr>MachineOutliner.cpp Tue Apr 11 10:01:18 2017<br>
@@ -1098,7 +1098,7 @@ MachineOutliner::<wbr>createOutlinedFunction(<br>
// Create the function using an IR-level function.<br>
LLVMContext &C = M.getContext();<br>
Function *F = dyn_cast<Function>(<br>
- M.getOrInsertFunction(<wbr>NameStream.str(), Type::getVoidTy(C), nullptr));<br>
+ M.getOrInsertFunction(<wbr>NameStream.str(), Type::getVoidTy(C)));<br>
assert(F && "Function was null!");<br>
<br>
// NOTE: If this is linkonceodr, then we can take advantage of linker deduping<br>
<br>
Modified: llvm/trunk/lib/CodeGen/<wbr>SafeStack.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SafeStack.cpp?rev=299949&r1=299948&r2=299949&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/lib/<wbr>CodeGen/SafeStack.cpp?rev=<wbr>299949&r1=299948&r2=299949&<wbr>view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/lib/CodeGen/<wbr>SafeStack.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/<wbr>SafeStack.cpp Tue Apr 11 10:01:18 2017<br>
@@ -451,7 +451,7 @@ void SafeStack::checkStackGuard(<wbr>IRBuilde<br>
IRBuilder<> IRBFail(CheckTerm);<br>
// FIXME: respect -fsanitize-trap / -ftrap-function here?<br>
Constant *StackChkFail = F.getParent()-><wbr>getOrInsertFunction(<br>
- "__stack_chk_fail", IRB.getVoidTy(), nullptr);<br>
+ "__stack_chk_fail", IRB.getVoidTy());<br>
IRBFail.CreateCall(<wbr>StackChkFail, {});<br>
}<br>
<br>
<br>
Modified: llvm/trunk/lib/CodeGen/<wbr>SjLjEHPrepare.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SjLjEHPrepare.cpp?rev=299949&r1=299948&r2=299949&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/lib/<wbr>CodeGen/SjLjEHPrepare.cpp?rev=<wbr>299949&r1=299948&r2=299949&<wbr>view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/lib/CodeGen/<wbr>SjLjEHPrepare.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/<wbr>SjLjEHPrepare.cpp Tue Apr 11 10:01:18 2017<br>
@@ -482,10 +482,10 @@ bool SjLjEHPrepare::runOnFunction(<wbr>Functi<br>
Module &M = *F.getParent();<br>
RegisterFn = M.getOrInsertFunction(<br>
"_Unwind_SjLj_Register", Type::getVoidTy(M.getContext()<wbr>),<br>
- PointerType::getUnqual(<wbr>FunctionContextTy), nullptr);<br>
+ PointerType::getUnqual(<wbr>FunctionContextTy));<br>
UnregisterFn = M.getOrInsertFunction(<br>
"_Unwind_SjLj_Unregister", Type::getVoidTy(M.getContext()<wbr>),<br>
- PointerType::getUnqual(<wbr>FunctionContextTy), nullptr);<br>
+ PointerType::getUnqual(<wbr>FunctionContextTy));<br>
FrameAddrFn = Intrinsic::getDeclaration(&M, Intrinsic::frameaddress);<br>
StackAddrFn = Intrinsic::getDeclaration(&M, Intrinsic::stacksave);<br>
StackRestoreFn = Intrinsic::getDeclaration(&M, Intrinsic::stackrestore);<br>
<br>
Modified: llvm/trunk/lib/CodeGen/<wbr>StackProtector.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/StackProtector.cpp?rev=299949&r1=299948&r2=299949&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/lib/<wbr>CodeGen/StackProtector.cpp?<wbr>rev=299949&r1=299948&r2=<wbr>299949&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/lib/CodeGen/<wbr>StackProtector.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/<wbr>StackProtector.cpp Tue Apr 11 10:01:18 2017<br>
@@ -484,13 +484,13 @@ BasicBlock *StackProtector::CreateFailBB<br>
Constant *StackChkFail =<br>
M->getOrInsertFunction("__<wbr>stack_smash_handler",<br>
Type::getVoidTy(Context),<br>
- Type::getInt8PtrTy(Context), nullptr);<br>
+ Type::getInt8PtrTy(Context));<br>
<br>
B.CreateCall(StackChkFail, B.CreateGlobalStringPtr(F-><wbr>getName(), "SSH"));<br>
} else {<br>
Constant *StackChkFail =<br>
- M->getOrInsertFunction("__<wbr>stack_chk_fail", Type::getVoidTy(Context),<br>
- nullptr);<br>
+ M->getOrInsertFunction("__<wbr>stack_chk_fail", Type::getVoidTy(Context));<br>
+<br>
B.CreateCall(StackChkFail, {});<br>
}<br>
B.CreateUnreachable();<br>
<br>
Modified: llvm/trunk/lib/CodeGen/<wbr>TargetLoweringBase.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TargetLoweringBase.cpp?rev=299949&r1=299948&r2=299949&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/lib/<wbr>CodeGen/TargetLoweringBase.<wbr>cpp?rev=299949&r1=299948&r2=<wbr>299949&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/lib/CodeGen/<wbr>TargetLoweringBase.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/<wbr>TargetLoweringBase.cpp Tue Apr 11 10:01:18 2017<br>
@@ -1818,7 +1818,7 @@ Value *TargetLoweringBase::<wbr>getSafeStackP<br>
Module *M = IRB.GetInsertBlock()-><wbr>getParent()->getParent();<br>
Type *StackPtrTy = Type::getInt8PtrTy(M-><wbr>getContext());<br>
Value *Fn = M->getOrInsertFunction("__<wbr>safestack_pointer_address",<br>
- StackPtrTy->getPointerTo(0), nullptr);<br>
+ StackPtrTy->getPointerTo(0));<br>
return IRB.CreateCall(Fn);<br>
}<br>
<br>
<br>
Modified: llvm/trunk/lib/IR/<wbr>Instructions.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Instructions.cpp?rev=299949&r1=299948&r2=299949&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/lib/IR/<wbr>Instructions.cpp?rev=299949&<wbr>r1=299948&r2=299949&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/lib/IR/<wbr>Instructions.cpp (original)<br>
+++ llvm/trunk/lib/IR/<wbr>Instructions.cpp Tue Apr 11 10:01:18 2017<br>
@@ -466,7 +466,7 @@ static Instruction *createMalloc(Instruc<br>
Value *MallocFunc = MallocF;<br>
if (!MallocFunc)<br>
// prototype malloc as "void *malloc(size_t)"<br>
- MallocFunc = M->getOrInsertFunction("<wbr>malloc", BPTy, IntPtrTy, nullptr);<br>
+ MallocFunc = M->getOrInsertFunction("<wbr>malloc", BPTy, IntPtrTy);<br>
PointerType *AllocPtrType = PointerType::getUnqual(<wbr>AllocTy);<br>
CallInst *MCall = nullptr;<br>
Instruction *Result = nullptr;<br>
@@ -560,7 +560,7 @@ static Instruction *createFree(Value *So<br>
Type *VoidTy = Type::getVoidTy(M->getContext(<wbr>));<br>
Type *IntPtrTy = Type::getInt8PtrTy(M-><wbr>getContext());<br>
// prototype free as "void free(void*)"<br>
- Value *FreeFunc = M->getOrInsertFunction("free", VoidTy, IntPtrTy, nullptr);<br>
+ Value *FreeFunc = M->getOrInsertFunction("free", VoidTy, IntPtrTy);<br>
CallInst *Result = nullptr;<br>
Value *PtrCast = Source;<br>
if (InsertBefore) {<br>
<br>
Modified: llvm/trunk/lib/IR/Module.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Module.cpp?rev=299949&r1=299948&r2=299949&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/lib/IR/<wbr>Module.cpp?rev=299949&r1=<wbr>299948&r2=299949&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/lib/IR/Module.cpp (original)<br>
+++ llvm/trunk/lib/IR/Module.cpp Tue Apr 11 10:01:18 2017<br>
@@ -147,47 +147,6 @@ Constant *Module::getOrInsertFunction(<wbr>St<br>
return getOrInsertFunction(Name, Ty, AttributeList());<br>
}<br>
<br>
-// getOrInsertFunction - Look up the specified function in the module symbol<br>
-// table. If it does not exist, add a prototype for the function and return it.<br>
-// This version of the method takes a null terminated list of function<br>
-// arguments, which makes it easier for clients to use.<br>
-//<br>
-Constant *Module::getOrInsertFunction(<wbr>StringRef Name,<br>
- AttributeList AttributeList, Type *RetTy,<br>
- ...) {<br>
- va_list Args;<br>
- va_start(Args, RetTy);<br>
-<br>
- // Build the list of argument types...<br>
- std::vector<Type*> ArgTys;<br>
- while (Type *ArgTy = va_arg(Args, Type*))<br>
- ArgTys.push_back(ArgTy);<br>
-<br>
- va_end(Args);<br>
-<br>
- // Build the function type and chain to the other getOrInsertFunction...<br>
- return getOrInsertFunction(Name,<br>
- FunctionType::get(RetTy, ArgTys, false),<br>
- AttributeList);<br>
-}<br>
-<br>
-Constant *Module::getOrInsertFunction(<wbr>StringRef Name,<br>
- Type *RetTy, ...) {<br>
- va_list Args;<br>
- va_start(Args, RetTy);<br>
-<br>
- // Build the list of argument types...<br>
- std::vector<Type*> ArgTys;<br>
- while (Type *ArgTy = va_arg(Args, Type*))<br>
- ArgTys.push_back(ArgTy);<br>
-<br>
- va_end(Args);<br>
-<br>
- // Build the function type and chain to the other getOrInsertFunction...<br>
- return getOrInsertFunction(Name, FunctionType::get(RetTy, ArgTys, false),<br>
- AttributeList());<br>
-}<br>
-<br>
// getFunction - Look up the specified function in the module symbol table.<br>
// If it does not exist, return null.<br>
//<br>
<br>
Modified: llvm/trunk/lib/Target/Hexagon/<wbr>HexagonLoopIdiomRecognition.<wbr>cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp?rev=299949&r1=299948&r2=299949&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/lib/Target/<wbr>Hexagon/<wbr>HexagonLoopIdiomRecognition.<wbr>cpp?rev=299949&r1=299948&r2=<wbr>299949&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/lib/Target/Hexagon/<wbr>HexagonLoopIdiomRecognition.<wbr>cpp (original)<br>
+++ llvm/trunk/lib/Target/Hexagon/<wbr>HexagonLoopIdiomRecognition.<wbr>cpp Tue Apr 11 10:01:18 2017<br>
@@ -2146,8 +2146,7 @@ CleanupAndExit:<br>
Type *VoidTy = Type::getVoidTy(Ctx);<br>
Module *M = Func->getParent();<br>
Constant *CF = M->getOrInsertFunction(<wbr>HexagonVolatileMemcpyName, VoidTy,<br>
- Int32PtrTy, Int32PtrTy, Int32Ty,<br>
- nullptr);<br>
+ Int32PtrTy, Int32PtrTy, Int32Ty);<br>
Function *Fn = cast<Function>(CF);<br>
Fn->setLinkage(Function::<wbr>ExternalLinkage);<br>
<br>
<br>
Modified: llvm/trunk/lib/Target/Mips/<wbr>Mips16HardFloat.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/Mips16HardFloat.cpp?rev=299949&r1=299948&r2=299949&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/lib/Target/<wbr>Mips/Mips16HardFloat.cpp?rev=<wbr>299949&r1=299948&r2=299949&<wbr>view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/lib/Target/Mips/<wbr>Mips16HardFloat.cpp (original)<br>
+++ llvm/trunk/lib/Target/Mips/<wbr>Mips16HardFloat.cpp Tue Apr 11 10:01:18 2017<br>
@@ -420,7 +420,7 @@ static bool fixupFPReturnAndCall(Functio<br>
Attribute::ReadNone);<br>
A = A.addAttribute(C, AttributeList::FunctionIndex,<br>
Attribute::NoInline);<br>
- Value *F = (M->getOrInsertFunction(Name, A, MyVoid, T, nullptr));<br>
+ Value *F = (M->getOrInsertFunction(Name, A, MyVoid, T));<br>
CallInst::Create(F, Params, "", &I);<br>
} else if (const CallInst *CI = dyn_cast<CallInst>(&I)) {<br>
FunctionType *FT = CI->getFunctionType();<br>
<br>
Modified: llvm/trunk/lib/Target/X86/<wbr>X86ISelLowering.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=299949&r1=299948&r2=299949&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/lib/Target/<wbr>X86/X86ISelLowering.cpp?rev=<wbr>299949&r1=299948&r2=299949&<wbr>view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/lib/Target/X86/<wbr>X86ISelLowering.cpp (original)<br>
+++ llvm/trunk/lib/Target/X86/<wbr>X86ISelLowering.cpp Tue Apr 11 10:01:18 2017<br>
@@ -2101,7 +2101,7 @@ void X86TargetLowering::<wbr>insertSSPDeclara<br>
auto *SecurityCheckCookie = cast<Function>(<br>
M.getOrInsertFunction("__<wbr>security_check_cookie",<br>
Type::getVoidTy(M.getContext(<wbr>)),<br>
- Type::getInt8PtrTy(M.<wbr>getContext()), nullptr));<br>
+ Type::getInt8PtrTy(M.<wbr>getContext())));<br>
SecurityCheckCookie-><wbr>setCallingConv(CallingConv::<wbr>X86_FastCall);<br>
SecurityCheckCookie-><wbr>addAttribute(1, Attribute::AttrKind::InReg);<br>
return;<br>
<br>
Modified: llvm/trunk/lib/Transforms/IPO/<wbr>CrossDSOCFI.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/CrossDSOCFI.cpp?rev=299949&r1=299948&r2=299949&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/lib/<wbr>Transforms/IPO/CrossDSOCFI.<wbr>cpp?rev=299949&r1=299948&r2=<wbr>299949&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/lib/Transforms/IPO/<wbr>CrossDSOCFI.cpp (original)<br>
+++ llvm/trunk/lib/Transforms/IPO/<wbr>CrossDSOCFI.cpp Tue Apr 11 10:01:18 2017<br>
@@ -98,7 +98,7 @@ void CrossDSOCFI::buildCFICheck(<wbr>Module &<br>
LLVMContext &Ctx = M.getContext();<br>
Constant *C = M.getOrInsertFunction(<br>
"__cfi_check", Type::getVoidTy(Ctx), Type::getInt64Ty(Ctx),<br>
- Type::getInt8PtrTy(Ctx), Type::getInt8PtrTy(Ctx), nullptr);<br>
+ Type::getInt8PtrTy(Ctx), Type::getInt8PtrTy(Ctx));<br>
Function *F = dyn_cast<Function>(C);<br>
// Take over the existing function. The frontend emits a weak stub so that the<br>
// linker knows about the symbol; this pass replaces the function body.<br>
@@ -120,7 +120,7 @@ void CrossDSOCFI::buildCFICheck(<wbr>Module &<br>
IRBuilder<> IRBFail(TrapBB);<br>
Constant *CFICheckFailFn = M.getOrInsertFunction(<br>
"__cfi_check_fail", Type::getVoidTy(Ctx), Type::getInt8PtrTy(Ctx),<br>
- Type::getInt8PtrTy(Ctx), nullptr);<br>
+ Type::getInt8PtrTy(Ctx));<br>
IRBFail.CreateCall(<wbr>CFICheckFailFn, {&CFICheckFailData, &Addr});<br>
IRBFail.CreateBr(ExitBB);<br>
<br>
<br>
Modified: llvm/trunk/lib/Transforms/IPO/<wbr>WholeProgramDevirt.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/WholeProgramDevirt.cpp?rev=299949&r1=299948&r2=299949&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/lib/<wbr>Transforms/IPO/<wbr>WholeProgramDevirt.cpp?rev=<wbr>299949&r1=299948&r2=299949&<wbr>view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/lib/Transforms/IPO/<wbr>WholeProgramDevirt.cpp (original)<br>
+++ llvm/trunk/lib/Transforms/IPO/<wbr>WholeProgramDevirt.cpp Tue Apr 11 10:01:18 2017<br>
@@ -1221,7 +1221,7 @@ void DevirtModule::<wbr>importResolution(VTab<br>
// The type of the function in the declaration is irrelevant because every<br>
// call site will cast it to the correct type.<br>
auto *SingleImpl = M.getOrInsertFunction(<br>
- Res.SingleImplName, Type::getVoidTy(M.getContext()<wbr>), nullptr);<br>
+ Res.SingleImplName, Type::getVoidTy(M.getContext()<wbr>));<br>
<br>
// This is the import phase so we should not be exporting anything.<br>
bool IsExported = false;<br>
<br>
Modified: llvm/trunk/lib/Transforms/<wbr>Instrumentation/<wbr>AddressSanitizer.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp?rev=299949&r1=299948&r2=299949&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/lib/<wbr>Transforms/Instrumentation/<wbr>AddressSanitizer.cpp?rev=<wbr>299949&r1=299948&r2=299949&<wbr>view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/lib/Transforms/<wbr>Instrumentation/<wbr>AddressSanitizer.cpp (original)<br>
+++ llvm/trunk/lib/Transforms/<wbr>Instrumentation/<wbr>AddressSanitizer.cpp Tue Apr 11 10:01:18 2017<br>
@@ -1568,31 +1568,31 @@ void AddressSanitizerModule::<wbr>initializeC<br>
<br>
// Declare our poisoning and unpoisoning functions.<br>
AsanPoisonGlobals = checkSanitizerInterfaceFunctio<wbr>n(M.getOrInsertFunction(<br>
- kAsanPoisonGlobalsName, IRB.getVoidTy(), IntptrTy, nullptr));<br>
+ kAsanPoisonGlobalsName, IRB.getVoidTy(), IntptrTy));<br>
AsanPoisonGlobals-><wbr>setLinkage(Function::<wbr>ExternalLinkage);<br>
AsanUnpoisonGlobals = checkSanitizerInterfaceFunctio<wbr>n(M.getOrInsertFunction(<br>
- kAsanUnpoisonGlobalsName, IRB.getVoidTy(), nullptr));<br>
+ kAsanUnpoisonGlobalsName, IRB.getVoidTy()));<br>
AsanUnpoisonGlobals-><wbr>setLinkage(Function::<wbr>ExternalLinkage);<br>
<br>
// Declare functions that register/unregister globals.<br>
AsanRegisterGlobals = checkSanitizerInterfaceFunctio<wbr>n(M.getOrInsertFunction(<br>
- kAsanRegisterGlobalsName, IRB.getVoidTy(), IntptrTy, IntptrTy, nullptr));<br>
+ kAsanRegisterGlobalsName, IRB.getVoidTy(), IntptrTy, IntptrTy));<br>
AsanRegisterGlobals-><wbr>setLinkage(Function::<wbr>ExternalLinkage);<br>
AsanUnregisterGlobals = checkSanitizerInterfaceFunctio<wbr>n(<br>
M.getOrInsertFunction(<wbr>kAsanUnregisterGlobalsName, IRB.getVoidTy(),<br>
- IntptrTy, IntptrTy, nullptr));<br>
+ IntptrTy, IntptrTy));<br>
AsanUnregisterGlobals-><wbr>setLinkage(Function::<wbr>ExternalLinkage);<br>
<br>
// Declare the functions that find globals in a shared object and then invoke<br>
// the (un)register function on them.<br>
AsanRegisterImageGlobals =<br>
<wbr>checkSanitizerInterfaceFunctio<wbr>n(M.getOrInsertFunction(<br>
- kAsanRegisterImageGlobalsName, IRB.getVoidTy(), IntptrTy, nullptr));<br>
+ kAsanRegisterImageGlobalsName, IRB.getVoidTy(), IntptrTy));<br>
AsanRegisterImageGlobals-><wbr>setLinkage(Function::<wbr>ExternalLinkage);<br>
<br>
AsanUnregisterImageGlobals =<br>
<wbr>checkSanitizerInterfaceFunctio<wbr>n(M.getOrInsertFunction(<br>
- kAsanUnregisterImageGlobalsNam<wbr>e, IRB.getVoidTy(), IntptrTy, nullptr));<br>
+ kAsanUnregisterImageGlobalsNam<wbr>e, IRB.getVoidTy(), IntptrTy));<br>
AsanUnregisterImageGlobals-><wbr>setLinkage(Function::<wbr>ExternalLinkage);<br>
}<br>
<br>
@@ -1963,49 +1963,60 @@ void AddressSanitizer::<wbr>initializeCallbac<br>
const std::string ExpStr = Exp ? "exp_" : "";<br>
const std::string SuffixStr = CompileKernel ? "N" : "_n";<br>
const std::string EndingStr = Recover ? "_noabort" : "";<br>
- Type *ExpType = Exp ? Type::getInt32Ty(*C) : nullptr;<br>
- AsanErrorCallbackSized[<wbr>AccessIsWrite][Exp] =<br>
- checkSanitizerInterfaceFunctio<wbr>n(M.getOrInsertFunction(<br>
- kAsanReportErrorTemplate + ExpStr + TypeStr + SuffixStr + EndingStr,<br>
- IRB.getVoidTy(), IntptrTy, IntptrTy, ExpType, nullptr));<br>
- AsanMemoryAccessCallbackSized[<wbr>AccessIsWrite][Exp] =<br>
- checkSanitizerInterfaceFunctio<wbr>n(M.getOrInsertFunction(<br>
- ClMemoryAccessCallbackPrefix + ExpStr + TypeStr + "N" + EndingStr,<br>
- IRB.getVoidTy(), IntptrTy, IntptrTy, ExpType, nullptr));<br>
- for (size_t AccessSizeIndex = 0; AccessSizeIndex < kNumberOfAccessSizes;<br>
- AccessSizeIndex++) {<br>
- const std::string Suffix = TypeStr + itostr(1ULL << AccessSizeIndex);<br>
- AsanErrorCallback[<wbr>AccessIsWrite][Exp][<wbr>AccessSizeIndex] =<br>
- checkSanitizerInterfaceFunctio<wbr>n(M.getOrInsertFunction(<br>
- kAsanReportErrorTemplate + ExpStr + Suffix + EndingStr,<br>
- IRB.getVoidTy(), IntptrTy, ExpType, nullptr));<br>
- AsanMemoryAccessCallback[<wbr>AccessIsWrite][Exp][<wbr>AccessSizeIndex] =<br>
- checkSanitizerInterfaceFunctio<wbr>n(M.getOrInsertFunction(<br>
- ClMemoryAccessCallbackPrefix + ExpStr + Suffix + EndingStr,<br>
- IRB.getVoidTy(), IntptrTy, ExpType, nullptr));<br>
+<br>
+ SmallVector<Type *, 3> Args2 = {IntptrTy, IntptrTy};<br>
+ SmallVector<Type *, 2> Args1{1, IntptrTy};<br>
+ if (Exp) {<br>
+ Type *ExpType = Type::getInt32Ty(*C);<br>
+ Args2.push_back(ExpType);<br>
+ Args1.push_back(ExpType);<br>
}<br>
- }<br>
+ AsanErrorCallbackSized[<wbr>AccessIsWrite][Exp] =<br>
+ <wbr>checkSanitizerInterfaceFunctio<wbr>n(M.getOrInsertFunction(<br>
+ kAsanReportErrorTemplate + ExpStr + TypeStr + SuffixStr +<br>
+ EndingStr,<br>
+ FunctionType::get(IRB.<wbr>getVoidTy(), Args2, false)));<br>
+<br>
+ <wbr>AsanMemoryAccessCallbackSized[<wbr>AccessIsWrite][Exp] =<br>
+ <wbr>checkSanitizerInterfaceFunctio<wbr>n(M.getOrInsertFunction(<br>
+ ClMemoryAccessCallbackPrefix + ExpStr + TypeStr + "N" + EndingStr,<br>
+ FunctionType::get(IRB.<wbr>getVoidTy(), Args2, false)));<br>
+<br>
+ for (size_t AccessSizeIndex = 0; AccessSizeIndex < kNumberOfAccessSizes;<br>
+ AccessSizeIndex++) {<br>
+ const std::string Suffix = TypeStr + itostr(1ULL << AccessSizeIndex);<br>
+ AsanErrorCallback[<wbr>AccessIsWrite][Exp][<wbr>AccessSizeIndex] =<br>
+ <wbr>checkSanitizerInterfaceFunctio<wbr>n(M.getOrInsertFunction(<br>
+ kAsanReportErrorTemplate + ExpStr + Suffix + EndingStr,<br>
+ FunctionType::get(IRB.<wbr>getVoidTy(), Args1, false)));<br>
+<br>
+ AsanMemoryAccessCallback[<wbr>AccessIsWrite][Exp][<wbr>AccessSizeIndex] =<br>
+ <wbr>checkSanitizerInterfaceFunctio<wbr>n(M.getOrInsertFunction(<br>
+ ClMemoryAccessCallbackPrefix + ExpStr + Suffix + EndingStr,<br>
+ FunctionType::get(IRB.<wbr>getVoidTy(), Args1, false)));<br>
+ }<br>
+ }<br>
}<br>
<br>
const std::string MemIntrinCallbackPrefix =<br>
CompileKernel ? std::string("") : ClMemoryAccessCallbackPrefix;<br>
AsanMemmove = checkSanitizerInterfaceFunctio<wbr>n(M.getOrInsertFunction(<br>
MemIntrinCallbackPrefix + "memmove", IRB.getInt8PtrTy(),<br>
- IRB.getInt8PtrTy(), IRB.getInt8PtrTy(), IntptrTy, nullptr));<br>
+ IRB.getInt8PtrTy(), IRB.getInt8PtrTy(), IntptrTy));<br>
AsanMemcpy = checkSanitizerInterfaceFunctio<wbr>n(M.getOrInsertFunction(<br>
MemIntrinCallbackPrefix + "memcpy", IRB.getInt8PtrTy(),<br>
- IRB.getInt8PtrTy(), IRB.getInt8PtrTy(), IntptrTy, nullptr));<br>
+ IRB.getInt8PtrTy(), IRB.getInt8PtrTy(), IntptrTy));<br>
AsanMemset = checkSanitizerInterfaceFunctio<wbr>n(M.getOrInsertFunction(<br>
MemIntrinCallbackPrefix + "memset", IRB.getInt8PtrTy(),<br>
- IRB.getInt8PtrTy(), IRB.getInt32Ty(), IntptrTy, nullptr));<br>
+ IRB.getInt8PtrTy(), IRB.getInt32Ty(), IntptrTy));<br>
<br>
AsanHandleNoReturnFunc = checkSanitizerInterfaceFunctio<wbr>n(<br>
- M.getOrInsertFunction(<wbr>kAsanHandleNoReturnName, IRB.getVoidTy(), nullptr));<br>
+ M.getOrInsertFunction(<wbr>kAsanHandleNoReturnName, IRB.getVoidTy()));<br>
<br>
AsanPtrCmpFunction = checkSanitizerInterfaceFunctio<wbr>n(M.getOrInsertFunction(<br>
- kAsanPtrCmp, IRB.getVoidTy(), IntptrTy, IntptrTy, nullptr));<br>
+ kAsanPtrCmp, IRB.getVoidTy(), IntptrTy, IntptrTy));<br>
AsanPtrSubFunction = checkSanitizerInterfaceFunctio<wbr>n(M.getOrInsertFunction(<br>
- kAsanPtrSub, IRB.getVoidTy(), IntptrTy, IntptrTy, nullptr));<br>
+ kAsanPtrSub, IRB.getVoidTy(), IntptrTy, IntptrTy));<br>
// We insert an empty inline asm after __asan_report* to avoid callback merge.<br>
EmptyAsm = InlineAsm::get(FunctionType::<wbr>get(IRB.getVoidTy(), false),<br>
StringRef(""), StringRef(""),<br>
@@ -2242,18 +2253,18 @@ void FunctionStackPoisoner::<wbr>initializeCa<br>
std::string Suffix = itostr(i);<br>
AsanStackMallocFunc[i] = checkSanitizerInterfaceFunctio<wbr>n(<br>
M.getOrInsertFunction(<wbr>kAsanStackMallocNameTemplate + Suffix, IntptrTy,<br>
- IntptrTy, nullptr));<br>
+ IntptrTy));<br>
AsanStackFreeFunc[i] = checkSanitizerInterfaceFunctio<wbr>n(<br>
M.getOrInsertFunction(<wbr>kAsanStackFreeNameTemplate + Suffix,<br>
- IRB.getVoidTy(), IntptrTy, IntptrTy, nullptr));<br>
+ IRB.getVoidTy(), IntptrTy, IntptrTy));<br>
}<br>
if (ASan.UseAfterScope) {<br>
AsanPoisonStackMemoryFunc = checkSanitizerInterfaceFunctio<wbr>n(<br>
M.getOrInsertFunction(<wbr>kAsanPoisonStackMemoryName, IRB.getVoidTy(),<br>
- IntptrTy, IntptrTy, nullptr));<br>
+ IntptrTy, IntptrTy));<br>
AsanUnpoisonStackMemoryFunc = checkSanitizerInterfaceFunctio<wbr>n(<br>
M.getOrInsertFunction(<wbr>kAsanUnpoisonStackMemoryName, IRB.getVoidTy(),<br>
- IntptrTy, IntptrTy, nullptr));<br>
+ IntptrTy, IntptrTy));<br>
}<br>
<br>
for (size_t Val : {0x00, 0xf1, 0xf2, 0xf3, 0xf5, 0xf8}) {<br>
@@ -2262,14 +2273,14 @@ void FunctionStackPoisoner::<wbr>initializeCa<br>
Name << std::setw(2) << std::setfill('0') << std::hex << Val;<br>
AsanSetShadowFunc[Val] =<br>
<wbr>checkSanitizerInterfaceFunctio<wbr>n(M.getOrInsertFunction(<br>
- Name.str(), IRB.getVoidTy(), IntptrTy, IntptrTy, nullptr));<br>
+ Name.str(), IRB.getVoidTy(), IntptrTy, IntptrTy));<br>
}<br>
<br>
AsanAllocaPoisonFunc = checkSanitizerInterfaceFunctio<wbr>n(M.getOrInsertFunction(<br>
- kAsanAllocaPoison, IRB.getVoidTy(), IntptrTy, IntptrTy, nullptr));<br>
+ kAsanAllocaPoison, IRB.getVoidTy(), IntptrTy, IntptrTy));<br>
AsanAllocasUnpoisonFunc =<br>
<wbr>checkSanitizerInterfaceFunctio<wbr>n(M.getOrInsertFunction(<br>
- kAsanAllocasUnpoison, IRB.getVoidTy(), IntptrTy, IntptrTy, nullptr));<br>
+ kAsanAllocasUnpoison, IRB.getVoidTy(), IntptrTy, IntptrTy));<br>
}<br>
<br>
void FunctionStackPoisoner::<wbr>copyToShadowInline(ArrayRef<<wbr>uint8_t> ShadowMask,<br>
<br>
Modified: llvm/trunk/lib/Transforms/<wbr>Instrumentation/<wbr>EfficiencySanitizer.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/EfficiencySanitizer.cpp?rev=299949&r1=299948&r2=299949&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/lib/<wbr>Transforms/Instrumentation/<wbr>EfficiencySanitizer.cpp?rev=<wbr>299949&r1=299948&r2=299949&<wbr>view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/lib/Transforms/<wbr>Instrumentation/<wbr>EfficiencySanitizer.cpp (original)<br>
+++ llvm/trunk/lib/Transforms/<wbr>Instrumentation/<wbr>EfficiencySanitizer.cpp Tue Apr 11 10:01:18 2017<br>
@@ -267,35 +267,35 @@ void EfficiencySanitizer::<wbr>initializeCall<br>
SmallString<32> AlignedLoadName("__esan_<wbr>aligned_load" + ByteSizeStr);<br>
EsanAlignedLoad[Idx] =<br>
<wbr>checkSanitizerInterfaceFunctio<wbr>n(M.getOrInsertFunction(<br>
- AlignedLoadName, IRB.getVoidTy(), IRB.getInt8PtrTy(), nullptr));<br>
+ AlignedLoadName, IRB.getVoidTy(), IRB.getInt8PtrTy()));<br>
SmallString<32> AlignedStoreName("__esan_<wbr>aligned_store" + ByteSizeStr);<br>
EsanAlignedStore[Idx] =<br>
<wbr>checkSanitizerInterfaceFunctio<wbr>n(M.getOrInsertFunction(<br>
- AlignedStoreName, IRB.getVoidTy(), IRB.getInt8PtrTy(), nullptr));<br>
+ AlignedStoreName, IRB.getVoidTy(), IRB.getInt8PtrTy()));<br>
SmallString<32> UnalignedLoadName("__esan_<wbr>unaligned_load" + ByteSizeStr);<br>
EsanUnalignedLoad[Idx] =<br>
<wbr>checkSanitizerInterfaceFunctio<wbr>n(M.getOrInsertFunction(<br>
- UnalignedLoadName, IRB.getVoidTy(), IRB.getInt8PtrTy(), nullptr));<br>
+ UnalignedLoadName, IRB.getVoidTy(), IRB.getInt8PtrTy()));<br>
SmallString<32> UnalignedStoreName("__esan_<wbr>unaligned_store" + ByteSizeStr);<br>
EsanUnalignedStore[Idx] =<br>
<wbr>checkSanitizerInterfaceFunctio<wbr>n(M.getOrInsertFunction(<br>
- UnalignedStoreName, IRB.getVoidTy(), IRB.getInt8PtrTy(), nullptr));<br>
+ UnalignedStoreName, IRB.getVoidTy(), IRB.getInt8PtrTy()));<br>
}<br>
EsanUnalignedLoadN = checkSanitizerInterfaceFunctio<wbr>n(<br>
M.getOrInsertFunction("__<wbr>esan_unaligned_loadN", IRB.getVoidTy(),<br>
- IRB.getInt8PtrTy(), IntptrTy, nullptr));<br>
+ IRB.getInt8PtrTy(), IntptrTy));<br>
EsanUnalignedStoreN = checkSanitizerInterfaceFunctio<wbr>n(<br>
M.getOrInsertFunction("__<wbr>esan_unaligned_storeN", IRB.getVoidTy(),<br>
- IRB.getInt8PtrTy(), IntptrTy, nullptr));<br>
+ IRB.getInt8PtrTy(), IntptrTy));<br>
MemmoveFn = checkSanitizerInterfaceFunctio<wbr>n(<br>
M.getOrInsertFunction("<wbr>memmove", IRB.getInt8PtrTy(), IRB.getInt8PtrTy(),<br>
- IRB.getInt8PtrTy(), IntptrTy, nullptr));<br>
+ IRB.getInt8PtrTy(), IntptrTy));<br>
MemcpyFn = checkSanitizerInterfaceFunctio<wbr>n(<br>
M.getOrInsertFunction("<wbr>memcpy", IRB.getInt8PtrTy(), IRB.getInt8PtrTy(),<br>
- IRB.getInt8PtrTy(), IntptrTy, nullptr));<br>
+ IRB.getInt8PtrTy(), IntptrTy));<br>
MemsetFn = checkSanitizerInterfaceFunctio<wbr>n(<br>
M.getOrInsertFunction("<wbr>memset", IRB.getInt8PtrTy(), IRB.getInt8PtrTy(),<br>
- IRB.getInt32Ty(), IntptrTy, nullptr));<br>
+ IRB.getInt32Ty(), IntptrTy));<br>
}<br>
<br>
bool EfficiencySanitizer::<wbr>shouldIgnoreStructType(<wbr>StructType *StructTy) {<br>
@@ -533,7 +533,7 @@ void EfficiencySanitizer::<wbr>createDestruct<br>
IRBuilder<> IRB_Dtor(EsanDtorFunction-><wbr>getEntryBlock().getTerminator(<wbr>));<br>
Function *EsanExit = checkSanitizerInterfaceFunctio<wbr>n(<br>
M.getOrInsertFunction(<wbr>EsanExitName, IRB_Dtor.getVoidTy(),<br>
- Int8PtrTy, nullptr));<br>
+ Int8PtrTy));<br>
EsanExit->setLinkage(<wbr>Function::ExternalLinkage);<br>
IRB_Dtor.CreateCall(EsanExit, {ToolInfoArg});<br>
appendToGlobalDtors(M, EsanDtorFunction, EsanCtorAndDtorPriority);<br>
<br>
Modified: llvm/trunk/lib/Transforms/<wbr>Instrumentation/<wbr>MemorySanitizer.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/MemorySanitizer.cpp?rev=299949&r1=299948&r2=299949&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/lib/<wbr>Transforms/Instrumentation/<wbr>MemorySanitizer.cpp?rev=<wbr>299949&r1=299948&r2=299949&<wbr>view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/lib/Transforms/<wbr>Instrumentation/<wbr>MemorySanitizer.cpp (original)<br>
+++ llvm/trunk/lib/Transforms/<wbr>Instrumentation/<wbr>MemorySanitizer.cpp Tue Apr 11 10:01:18 2017<br>
@@ -425,7 +425,7 @@ void MemorySanitizer::<wbr>initializeCallback<br>
// which is not yet implemented.<br>
StringRef WarningFnName = Recover ? "__msan_warning"<br>
: "__msan_warning_noreturn";<br>
- WarningFn = M.getOrInsertFunction(<wbr>WarningFnName, IRB.getVoidTy(), nullptr);<br>
+ WarningFn = M.getOrInsertFunction(<wbr>WarningFnName, IRB.getVoidTy());<br>
<br>
for (size_t AccessSizeIndex = 0; AccessSizeIndex < kNumberOfAccessSizes;<br>
AccessSizeIndex++) {<br>
@@ -433,31 +433,31 @@ void MemorySanitizer::<wbr>initializeCallback<br>
std::string FunctionName = "__msan_maybe_warning_" + itostr(AccessSize);<br>
MaybeWarningFn[<wbr>AccessSizeIndex] = M.getOrInsertFunction(<br>
FunctionName, IRB.getVoidTy(), IRB.getIntNTy(AccessSize * 8),<br>
- IRB.getInt32Ty(), nullptr);<br>
+ IRB.getInt32Ty());<br>
<br>
FunctionName = "__msan_maybe_store_origin_" + itostr(AccessSize);<br>
MaybeStoreOriginFn[<wbr>AccessSizeIndex] = M.getOrInsertFunction(<br>
FunctionName, IRB.getVoidTy(), IRB.getIntNTy(AccessSize * 8),<br>
- IRB.getInt8PtrTy(), IRB.getInt32Ty(), nullptr);<br>
+ IRB.getInt8PtrTy(), IRB.getInt32Ty());<br>
}<br>
<br>
MsanSetAllocaOrigin4Fn = M.getOrInsertFunction(<br>
"__msan_set_alloca_origin4", IRB.getVoidTy(), IRB.getInt8PtrTy(), IntptrTy,<br>
- IRB.getInt8PtrTy(), IntptrTy, nullptr);<br>
+ IRB.getInt8PtrTy(), IntptrTy);<br>
MsanPoisonStackFn =<br>
M.getOrInsertFunction("__<wbr>msan_poison_stack", IRB.getVoidTy(),<br>
- IRB.getInt8PtrTy(), IntptrTy, nullptr);<br>
+ IRB.getInt8PtrTy(), IntptrTy);<br>
MsanChainOriginFn = M.getOrInsertFunction(<br>
- "__msan_chain_origin", IRB.getInt32Ty(), IRB.getInt32Ty(), nullptr);<br>
+ "__msan_chain_origin", IRB.getInt32Ty(), IRB.getInt32Ty());<br>
MemmoveFn = M.getOrInsertFunction(<br>
"__msan_memmove", IRB.getInt8PtrTy(), IRB.getInt8PtrTy(),<br>
- IRB.getInt8PtrTy(), IntptrTy, nullptr);<br>
+ IRB.getInt8PtrTy(), IntptrTy);<br>
MemcpyFn = M.getOrInsertFunction(<br>
"__msan_memcpy", IRB.getInt8PtrTy(), IRB.getInt8PtrTy(), IRB.getInt8PtrTy(),<br>
- IntptrTy, nullptr);<br>
+ IntptrTy);<br>
MemsetFn = M.getOrInsertFunction(<br>
"__msan_memset", IRB.getInt8PtrTy(), IRB.getInt8PtrTy(), IRB.getInt32Ty(),<br>
- IntptrTy, nullptr);<br>
+ IntptrTy);<br>
<br>
// Create globals.<br>
RetvalTLS = new GlobalVariable(<br>
<br>
Modified: llvm/trunk/lib/Transforms/<wbr>Instrumentation/<wbr>SanitizerCoverage.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/SanitizerCoverage.cpp?rev=299949&r1=299948&r2=299949&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/lib/<wbr>Transforms/Instrumentation/<wbr>SanitizerCoverage.cpp?rev=<wbr>299949&r1=299948&r2=299949&<wbr>view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/lib/Transforms/<wbr>Instrumentation/<wbr>SanitizerCoverage.cpp (original)<br>
+++ llvm/trunk/lib/Transforms/<wbr>Instrumentation/<wbr>SanitizerCoverage.cpp Tue Apr 11 10:01:18 2017<br>
@@ -262,39 +262,39 @@ bool SanitizerCoverageModule::<wbr>runOnModul<br>
Int32Ty = IRB.getInt32Ty();<br>
<br>
SanCovFunction = checkSanitizerInterfaceFunctio<wbr>n(<br>
- M.getOrInsertFunction(<wbr>SanCovName, VoidTy, Int32PtrTy, nullptr));<br>
+ M.getOrInsertFunction(<wbr>SanCovName, VoidTy, Int32PtrTy));<br>
SanCovWithCheckFunction = checkSanitizerInterfaceFunctio<wbr>n(<br>
- M.getOrInsertFunction(<wbr>SanCovWithCheckName, VoidTy, Int32PtrTy, nullptr));<br>
+ M.getOrInsertFunction(<wbr>SanCovWithCheckName, VoidTy, Int32PtrTy));<br>
SanCovTracePCIndir = checkSanitizerInterfaceFunctio<wbr>n(<br>
- M.getOrInsertFunction(<wbr>SanCovTracePCIndirName, VoidTy, IntptrTy, nullptr));<br>
+ M.getOrInsertFunction(<wbr>SanCovTracePCIndirName, VoidTy, IntptrTy));<br>
SanCovIndirCallFunction =<br>
<wbr>checkSanitizerInterfaceFunctio<wbr>n(M.getOrInsertFunction(<br>
- SanCovIndirCallName, VoidTy, IntptrTy, IntptrTy, nullptr));<br>
+ SanCovIndirCallName, VoidTy, IntptrTy, IntptrTy));<br>
SanCovTraceCmpFunction[0] =<br>
<wbr>checkSanitizerInterfaceFunctio<wbr>n(M.getOrInsertFunction(<br>
- SanCovTraceCmp1, VoidTy, IRB.getInt8Ty(), IRB.getInt8Ty(), nullptr));<br>
+ SanCovTraceCmp1, VoidTy, IRB.getInt8Ty(), IRB.getInt8Ty()));<br>
SanCovTraceCmpFunction[1] = checkSanitizerInterfaceFunctio<wbr>n(<br>
M.getOrInsertFunction(<wbr>SanCovTraceCmp2, VoidTy, IRB.getInt16Ty(),<br>
- IRB.getInt16Ty(), nullptr));<br>
+ IRB.getInt16Ty()));<br>
SanCovTraceCmpFunction[2] = checkSanitizerInterfaceFunctio<wbr>n(<br>
M.getOrInsertFunction(<wbr>SanCovTraceCmp4, VoidTy, IRB.getInt32Ty(),<br>
- IRB.getInt32Ty(), nullptr));<br>
+ IRB.getInt32Ty()));<br>
SanCovTraceCmpFunction[3] =<br>
<wbr>checkSanitizerInterfaceFunctio<wbr>n(M.getOrInsertFunction(<br>
- SanCovTraceCmp8, VoidTy, Int64Ty, Int64Ty, nullptr));<br>
+ SanCovTraceCmp8, VoidTy, Int64Ty, Int64Ty));<br>
<br>
SanCovTraceDivFunction[0] =<br>
<wbr>checkSanitizerInterfaceFunctio<wbr>n(M.getOrInsertFunction(<br>
- SanCovTraceDiv4, VoidTy, IRB.getInt32Ty(), nullptr));<br>
+ SanCovTraceDiv4, VoidTy, IRB.getInt32Ty()));<br>
SanCovTraceDivFunction[1] =<br>
<wbr>checkSanitizerInterfaceFunctio<wbr>n(M.getOrInsertFunction(<br>
- SanCovTraceDiv8, VoidTy, Int64Ty, nullptr));<br>
+ SanCovTraceDiv8, VoidTy, Int64Ty));<br>
SanCovTraceGepFunction =<br>
<wbr>checkSanitizerInterfaceFunctio<wbr>n(M.getOrInsertFunction(<br>
- SanCovTraceGep, VoidTy, IntptrTy, nullptr));<br>
+ SanCovTraceGep, VoidTy, IntptrTy));<br>
SanCovTraceSwitchFunction =<br>
<wbr>checkSanitizerInterfaceFunctio<wbr>n(M.getOrInsertFunction(<br>
- SanCovTraceSwitchName, VoidTy, Int64Ty, Int64PtrTy, nullptr));<br>
+ SanCovTraceSwitchName, VoidTy, Int64Ty, Int64PtrTy));<br>
<br>
// We insert an empty inline asm after cov callbacks to avoid callback merge.<br>
EmptyAsm = InlineAsm::get(FunctionType::<wbr>get(IRB.getVoidTy(), false),<br>
@@ -302,13 +302,13 @@ bool SanitizerCoverageModule::<wbr>runOnModul<br>
/*hasSideEffects=*/true);<br>
<br>
SanCovTracePC = checkSanitizerInterfaceFunctio<wbr>n(<br>
- M.getOrInsertFunction(<wbr>SanCovTracePCName, VoidTy, nullptr));<br>
+ M.getOrInsertFunction(<wbr>SanCovTracePCName, VoidTy));<br>
SanCovTracePCGuard = checkSanitizerInterfaceFunctio<wbr>n(M.getOrInsertFunction(<br>
- SanCovTracePCGuardName, VoidTy, Int32PtrTy, nullptr));<br>
+ SanCovTracePCGuardName, VoidTy, Int32PtrTy));<br>
SanCovTraceEnter = checkSanitizerInterfaceFunctio<wbr>n(<br>
- M.getOrInsertFunction(<wbr>SanCovTraceEnterName, VoidTy, Int32PtrTy, nullptr));<br>
+ M.getOrInsertFunction(<wbr>SanCovTraceEnterName, VoidTy, Int32PtrTy));<br>
SanCovTraceBB = checkSanitizerInterfaceFunctio<wbr>n(<br>
- M.getOrInsertFunction(<wbr>SanCovTraceBBName, VoidTy, Int32PtrTy, nullptr));<br>
+ M.getOrInsertFunction(<wbr>SanCovTraceBBName, VoidTy, Int32PtrTy));<br>
<br>
// At this point we create a dummy array of guards because we don't<br>
// know how many elements we will need.<br>
<br>
Modified: llvm/trunk/lib/Transforms/<wbr>Instrumentation/<wbr>ThreadSanitizer.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/ThreadSanitizer.cpp?rev=299949&r1=299948&r2=299949&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/lib/<wbr>Transforms/Instrumentation/<wbr>ThreadSanitizer.cpp?rev=<wbr>299949&r1=299948&r2=299949&<wbr>view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/lib/Transforms/<wbr>Instrumentation/<wbr>ThreadSanitizer.cpp (original)<br>
+++ llvm/trunk/lib/Transforms/<wbr>Instrumentation/<wbr>ThreadSanitizer.cpp Tue Apr 11 10:01:18 2017<br>
@@ -160,13 +160,13 @@ void ThreadSanitizer::<wbr>initializeCallback<br>
Attribute::NoUnwind);<br>
// Initialize the callbacks.<br>
TsanFuncEntry = checkSanitizerInterfaceFunctio<wbr>n(M.getOrInsertFunction(<br>
- "__tsan_func_entry", Attr, IRB.getVoidTy(), IRB.getInt8PtrTy(), nullptr));<br>
+ "__tsan_func_entry", Attr, IRB.getVoidTy(), IRB.getInt8PtrTy()));<br>
TsanFuncExit = checkSanitizerInterfaceFunctio<wbr>n(<br>
- M.getOrInsertFunction("__tsan_<wbr>func_exit", Attr, IRB.getVoidTy(), nullptr));<br>
+ M.getOrInsertFunction("__tsan_<wbr>func_exit", Attr, IRB.getVoidTy()));<br>
TsanIgnoreBegin = checkSanitizerInterfaceFunctio<wbr>n(M.getOrInsertFunction(<br>
- "__tsan_ignore_thread_begin", Attr, IRB.getVoidTy(), nullptr));<br>
+ "__tsan_ignore_thread_begin", Attr, IRB.getVoidTy()));<br>
TsanIgnoreEnd = checkSanitizerInterfaceFunctio<wbr>n(M.getOrInsertFunction(<br>
- "__tsan_ignore_thread_end", Attr, IRB.getVoidTy(), nullptr));<br>
+ "__tsan_ignore_thread_end", Attr, IRB.getVoidTy()));<br>
OrdTy = IRB.getInt32Ty();<br>
for (size_t i = 0; i < kNumberOfAccessSizes; ++i) {<br>
const unsigned ByteSize = 1U << i;<br>
@@ -175,31 +175,31 @@ void ThreadSanitizer::<wbr>initializeCallback<br>
std::string BitSizeStr = utostr(BitSize);<br>
SmallString<32> ReadName("__tsan_read" + ByteSizeStr);<br>
TsanRead[i] = checkSanitizerInterfaceFunctio<wbr>n(M.getOrInsertFunction(<br>
- ReadName, Attr, IRB.getVoidTy(), IRB.getInt8PtrTy(), nullptr));<br>
+ ReadName, Attr, IRB.getVoidTy(), IRB.getInt8PtrTy()));<br>
<br>
SmallString<32> WriteName("__tsan_write" + ByteSizeStr);<br>
TsanWrite[i] = checkSanitizerInterfaceFunctio<wbr>n(M.getOrInsertFunction(<br>
- WriteName, Attr, IRB.getVoidTy(), IRB.getInt8PtrTy(), nullptr));<br>
+ WriteName, Attr, IRB.getVoidTy(), IRB.getInt8PtrTy()));<br>
<br>
SmallString<64> UnalignedReadName("__tsan_<wbr>unaligned_read" + ByteSizeStr);<br>
TsanUnalignedRead[i] =<br>
<wbr>checkSanitizerInterfaceFunctio<wbr>n(M.getOrInsertFunction(<br>
- UnalignedReadName, Attr, IRB.getVoidTy(), IRB.getInt8PtrTy(), nullptr));<br>
+ UnalignedReadName, Attr, IRB.getVoidTy(), IRB.getInt8PtrTy()));<br>
<br>
SmallString<64> UnalignedWriteName("__tsan_<wbr>unaligned_write" + ByteSizeStr);<br>
TsanUnalignedWrite[i] =<br>
<wbr>checkSanitizerInterfaceFunctio<wbr>n(M.getOrInsertFunction(<br>
- UnalignedWriteName, Attr, IRB.getVoidTy(), IRB.getInt8PtrTy(), nullptr));<br>
+ UnalignedWriteName, Attr, IRB.getVoidTy(), IRB.getInt8PtrTy()));<br>
<br>
Type *Ty = Type::getIntNTy(M.getContext()<wbr>, BitSize);<br>
Type *PtrTy = Ty->getPointerTo();<br>
SmallString<32> AtomicLoadName("__tsan_atomic" + BitSizeStr + "_load");<br>
TsanAtomicLoad[i] = checkSanitizerInterfaceFunctio<wbr>n(<br>
- M.getOrInsertFunction(<wbr>AtomicLoadName, Attr, Ty, PtrTy, OrdTy, nullptr));<br>
+ M.getOrInsertFunction(<wbr>AtomicLoadName, Attr, Ty, PtrTy, OrdTy));<br>
<br>
SmallString<32> AtomicStoreName("__tsan_<wbr>atomic" + BitSizeStr + "_store");<br>
TsanAtomicStore[i] = checkSanitizerInterfaceFunctio<wbr>n(M.getOrInsertFunction(<br>
- AtomicStoreName, Attr, IRB.getVoidTy(), PtrTy, Ty, OrdTy, nullptr));<br>
+ AtomicStoreName, Attr, IRB.getVoidTy(), PtrTy, Ty, OrdTy));<br>
<br>
for (int op = AtomicRMWInst::FIRST_BINOP;<br>
op <= AtomicRMWInst::LAST_BINOP; ++op) {<br>
@@ -223,33 +223,33 @@ void ThreadSanitizer::<wbr>initializeCallback<br>
continue;<br>
SmallString<32> RMWName("__tsan_atomic" + itostr(BitSize) + NamePart);<br>
TsanAtomicRMW[op][i] = checkSanitizerInterfaceFunctio<wbr>n(<br>
- M.getOrInsertFunction(RMWName, Attr, Ty, PtrTy, Ty, OrdTy, nullptr));<br>
+ M.getOrInsertFunction(RMWName, Attr, Ty, PtrTy, Ty, OrdTy));<br>
}<br>
<br>
SmallString<32> AtomicCASName("__tsan_atomic" + BitSizeStr +<br>
"_compare_exchange_val");<br>
TsanAtomicCAS[i] = checkSanitizerInterfaceFunctio<wbr>n(M.getOrInsertFunction(<br>
- AtomicCASName, Attr, Ty, PtrTy, Ty, Ty, OrdTy, OrdTy, nullptr));<br>
+ AtomicCASName, Attr, Ty, PtrTy, Ty, Ty, OrdTy, OrdTy));<br>
}<br>
TsanVptrUpdate = checkSanitizerInterfaceFunctio<wbr>n(<br>
M.getOrInsertFunction("__<wbr>tsan_vptr_update", Attr, IRB.getVoidTy(),<br>
- IRB.getInt8PtrTy(), IRB.getInt8PtrTy(), nullptr));<br>
+ IRB.getInt8PtrTy(), IRB.getInt8PtrTy()));<br>
TsanVptrLoad = checkSanitizerInterfaceFunctio<wbr>n(M.getOrInsertFunction(<br>
- "__tsan_vptr_read", Attr, IRB.getVoidTy(), IRB.getInt8PtrTy(), nullptr));<br>
+ "__tsan_vptr_read", Attr, IRB.getVoidTy(), IRB.getInt8PtrTy()));<br>
TsanAtomicThreadFence = checkSanitizerInterfaceFunctio<wbr>n(M.getOrInsertFunction(<br>
- "__tsan_atomic_thread_fence", Attr, IRB.getVoidTy(), OrdTy, nullptr));<br>
+ "__tsan_atomic_thread_fence", Attr, IRB.getVoidTy(), OrdTy));<br>
TsanAtomicSignalFence = checkSanitizerInterfaceFunctio<wbr>n(M.getOrInsertFunction(<br>
- "__tsan_atomic_signal_fence", Attr, IRB.getVoidTy(), OrdTy, nullptr));<br>
+ "__tsan_atomic_signal_fence", Attr, IRB.getVoidTy(), OrdTy));<br>
<br>
MemmoveFn = checkSanitizerInterfaceFunctio<wbr>n(<br>
M.getOrInsertFunction("<wbr>memmove", Attr, IRB.getInt8PtrTy(), IRB.getInt8PtrTy(),<br>
- IRB.getInt8PtrTy(), IntptrTy, nullptr));<br>
+ IRB.getInt8PtrTy(), IntptrTy));<br>
MemcpyFn = checkSanitizerInterfaceFunctio<wbr>n(<br>
M.getOrInsertFunction("<wbr>memcpy", Attr, IRB.getInt8PtrTy(), IRB.getInt8PtrTy(),<br>
- IRB.getInt8PtrTy(), IntptrTy, nullptr));<br>
+ IRB.getInt8PtrTy(), IntptrTy));<br>
MemsetFn = checkSanitizerInterfaceFunctio<wbr>n(<br>
M.getOrInsertFunction("<wbr>memset", Attr, IRB.getInt8PtrTy(), IRB.getInt8PtrTy(),<br>
- IRB.getInt32Ty(), IntptrTy, nullptr));<br>
+ IRB.getInt32Ty(), IntptrTy));<br>
}<br>
<br>
bool ThreadSanitizer::<wbr>doInitialization(Module &M) {<br>
<br>
Modified: llvm/trunk/lib/Transforms/<wbr>Scalar/LoopIdiomRecognize.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopIdiomRecognize.cpp?rev=299949&r1=299948&r2=299949&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/lib/<wbr>Transforms/Scalar/<wbr>LoopIdiomRecognize.cpp?rev=<wbr>299949&r1=299948&r2=299949&<wbr>view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/lib/Transforms/<wbr>Scalar/LoopIdiomRecognize.cpp (original)<br>
+++ llvm/trunk/lib/Transforms/<wbr>Scalar/LoopIdiomRecognize.cpp Tue Apr 11 10:01:18 2017<br>
@@ -823,7 +823,7 @@ bool LoopIdiomRecognize::<wbr>processLoopStri<br>
Module *M = TheStore->getModule();<br>
Value *MSP =<br>
M->getOrInsertFunction("<wbr>memset_pattern16", Builder.getVoidTy(),<br>
- Int8PtrTy, Int8PtrTy, IntPtr, (void *)nullptr);<br>
+ Int8PtrTy, Int8PtrTy, IntPtr);<br>
inferLibFuncAttributes(*M-><wbr>getFunction("memset_pattern16"<wbr>), *TLI);<br>
<br>
// Otherwise we should form a memset_pattern16. PatternValue is known to be<br>
<br>
Modified: llvm/trunk/lib/Transforms/<wbr>Utils/BuildLibCalls.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/BuildLibCalls.cpp?rev=299949&r1=299948&r2=299949&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/lib/<wbr>Transforms/Utils/<wbr>BuildLibCalls.cpp?rev=299949&<wbr>r1=299948&r2=299949&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/lib/Transforms/<wbr>Utils/BuildLibCalls.cpp (original)<br>
+++ llvm/trunk/lib/Transforms/<wbr>Utils/BuildLibCalls.cpp Tue Apr 11 10:01:18 2017<br>
@@ -723,7 +723,7 @@ Value *llvm::emitStrLen(Value *Ptr, IRBu<br>
Module *M = B.GetInsertBlock()->getModule(<wbr>);<br>
LLVMContext &Context = B.GetInsertBlock()-><wbr>getContext();<br>
Constant *StrLen = M->getOrInsertFunction("<wbr>strlen", DL.getIntPtrType(Context),<br>
- B.getInt8PtrTy(), nullptr);<br>
+ B.getInt8PtrTy());<br>
inferLibFuncAttributes(*M-><wbr>getFunction("strlen"), *TLI);<br>
CallInst *CI = B.CreateCall(StrLen, castToCStr(Ptr, B), "strlen");<br>
if (const Function *F = dyn_cast<Function>(StrLen-><wbr>stripPointerCasts()))<br>
@@ -741,7 +741,7 @@ Value *llvm::emitStrChr(Value *Ptr, char<br>
Type *I8Ptr = B.getInt8PtrTy();<br>
Type *I32Ty = B.getInt32Ty();<br>
Constant *StrChr =<br>
- M->getOrInsertFunction("<wbr>strchr", I8Ptr, I8Ptr, I32Ty, nullptr);<br>
+ M->getOrInsertFunction("<wbr>strchr", I8Ptr, I8Ptr, I32Ty);<br>
inferLibFuncAttributes(*M-><wbr>getFunction("strchr"), *TLI);<br>
CallInst *CI = B.CreateCall(<br>
StrChr, {castToCStr(Ptr, B), ConstantInt::get(I32Ty, C)}, "strchr");<br>
@@ -759,7 +759,7 @@ Value *llvm::emitStrNCmp(Value *Ptr1, Va<br>
LLVMContext &Context = B.GetInsertBlock()-><wbr>getContext();<br>
Value *StrNCmp = M->getOrInsertFunction("<wbr>strncmp", B.getInt32Ty(),<br>
B.getInt8PtrTy(), B.getInt8PtrTy(),<br>
- DL.getIntPtrType(Context), nullptr);<br>
+ DL.getIntPtrType(Context));<br>
inferLibFuncAttributes(*M-><wbr>getFunction("strncmp"), *TLI);<br>
CallInst *CI = B.CreateCall(<br>
StrNCmp, {castToCStr(Ptr1, B), castToCStr(Ptr2, B), Len}, "strncmp");<br>
@@ -777,7 +777,7 @@ Value *llvm::emitStrCpy(Value *Dst, Valu<br>
<br>
Module *M = B.GetInsertBlock()->getModule(<wbr>);<br>
Type *I8Ptr = B.getInt8PtrTy();<br>
- Value *StrCpy = M->getOrInsertFunction(Name, I8Ptr, I8Ptr, I8Ptr, nullptr);<br>
+ Value *StrCpy = M->getOrInsertFunction(Name, I8Ptr, I8Ptr, I8Ptr);<br>
inferLibFuncAttributes(*M-><wbr>getFunction(Name), *TLI);<br>
CallInst *CI =<br>
B.CreateCall(StrCpy, {castToCStr(Dst, B), castToCStr(Src, B)}, Name);<br>
@@ -794,7 +794,7 @@ Value *llvm::emitStrNCpy(Value *Dst, Val<br>
Module *M = B.GetInsertBlock()->getModule(<wbr>);<br>
Type *I8Ptr = B.getInt8PtrTy();<br>
Value *StrNCpy = M->getOrInsertFunction(Name, I8Ptr, I8Ptr, I8Ptr,<br>
- Len->getType(), nullptr);<br>
+ Len->getType());<br>
inferLibFuncAttributes(*M-><wbr>getFunction(Name), *TLI);<br>
CallInst *CI = B.CreateCall(<br>
StrNCpy, {castToCStr(Dst, B), castToCStr(Src, B), Len}, "strncpy");<br>
@@ -817,7 +817,7 @@ Value *llvm::emitMemCpyChk(Value *Dst, V<br>
Value *MemCpy = M->getOrInsertFunction(<br>
"__memcpy_chk", AttributeList::get(M-><wbr>getContext(), AS), B.getInt8PtrTy(),<br>
B.getInt8PtrTy(), B.getInt8PtrTy(), DL.getIntPtrType(Context),<br>
- DL.getIntPtrType(Context), nullptr);<br>
+ DL.getIntPtrType(Context));<br>
Dst = castToCStr(Dst, B);<br>
Src = castToCStr(Src, B);<br>
CallInst *CI = B.CreateCall(MemCpy, {Dst, Src, Len, ObjSize});<br>
@@ -835,7 +835,7 @@ Value *llvm::emitMemChr(Value *Ptr, Valu<br>
LLVMContext &Context = B.GetInsertBlock()-><wbr>getContext();<br>
Value *MemChr = M->getOrInsertFunction("<wbr>memchr", B.getInt8PtrTy(),<br>
B.getInt8PtrTy(), B.getInt32Ty(),<br>
- DL.getIntPtrType(Context), nullptr);<br>
+ DL.getIntPtrType(Context));<br>
inferLibFuncAttributes(*M-><wbr>getFunction("memchr"), *TLI);<br>
CallInst *CI = B.CreateCall(MemChr, {castToCStr(Ptr, B), Val, Len}, "memchr");<br>
<br>
@@ -854,7 +854,7 @@ Value *llvm::emitMemCmp(Value *Ptr1, Val<br>
LLVMContext &Context = B.GetInsertBlock()-><wbr>getContext();<br>
Value *MemCmp = M->getOrInsertFunction("<wbr>memcmp", B.getInt32Ty(),<br>
B.getInt8PtrTy(), B.getInt8PtrTy(),<br>
- DL.getIntPtrType(Context), nullptr);<br>
+ DL.getIntPtrType(Context));<br>
inferLibFuncAttributes(*M-><wbr>getFunction("memcmp"), *TLI);<br>
CallInst *CI = B.CreateCall(<br>
MemCmp, {castToCStr(Ptr1, B), castToCStr(Ptr2, B), Len}, "memcmp");<br>
@@ -887,7 +887,7 @@ Value *llvm::emitUnaryFloatFnCall(<wbr>Value<br>
<br>
Module *M = B.GetInsertBlock()->getModule(<wbr>);<br>
Value *Callee = M->getOrInsertFunction(Name, Op->getType(),<br>
- Op->getType(), nullptr);<br>
+ Op->getType());<br>
CallInst *CI = B.CreateCall(Callee, Op, Name);<br>
CI->setAttributes(Attrs);<br>
if (const Function *F = dyn_cast<Function>(Callee-><wbr>stripPointerCasts()))<br>
@@ -903,7 +903,7 @@ Value *llvm::emitBinaryFloatFnCall(<wbr>Value<br>
<br>
Module *M = B.GetInsertBlock()->getModule(<wbr>);<br>
Value *Callee = M->getOrInsertFunction(Name, Op1->getType(), Op1->getType(),<br>
- Op2->getType(), nullptr);<br>
+ Op2->getType());<br>
CallInst *CI = B.CreateCall(Callee, {Op1, Op2}, Name);<br>
CI->setAttributes(Attrs);<br>
if (const Function *F = dyn_cast<Function>(Callee-><wbr>stripPointerCasts()))<br>
@@ -918,8 +918,7 @@ Value *llvm::emitPutChar(Value *Char, IR<br>
return nullptr;<br>
<br>
Module *M = B.GetInsertBlock()->getModule(<wbr>);<br>
- Value *PutChar = M->getOrInsertFunction("<wbr>putchar", B.getInt32Ty(),<br>
- B.getInt32Ty(), nullptr);<br>
+ Value *PutChar = M->getOrInsertFunction("<wbr>putchar", B.getInt32Ty(), B.getInt32Ty());<br>
inferLibFuncAttributes(*M-><wbr>getFunction("putchar"), *TLI);<br>
CallInst *CI = B.CreateCall(PutChar,<br>
B.CreateIntCast(Char,<br>
@@ -940,7 +939,7 @@ Value *llvm::emitPutS(Value *Str, IRBuil<br>
<br>
Module *M = B.GetInsertBlock()->getModule(<wbr>);<br>
Value *PutS =<br>
- M->getOrInsertFunction("puts", B.getInt32Ty(), B.getInt8PtrTy(), nullptr);<br>
+ M->getOrInsertFunction("puts", B.getInt32Ty(), B.getInt8PtrTy());<br>
inferLibFuncAttributes(*M-><wbr>getFunction("puts"), *TLI);<br>
CallInst *CI = B.CreateCall(PutS, castToCStr(Str, B), "puts");<br>
if (const Function *F = dyn_cast<Function>(PutS-><wbr>stripPointerCasts()))<br>
@@ -955,7 +954,7 @@ Value *llvm::emitFPutC(Value *Char, Valu<br>
<br>
Module *M = B.GetInsertBlock()->getModule(<wbr>);<br>
Constant *F = M->getOrInsertFunction("fputc"<wbr>, B.getInt32Ty(), B.getInt32Ty(),<br>
- File->getType(), nullptr);<br>
+ File->getType());<br>
if (File->getType()->isPointerTy(<wbr>))<br>
inferLibFuncAttributes(*M-><wbr>getFunction("fputc"), *TLI);<br>
Char = B.CreateIntCast(Char, B.getInt32Ty(), /*isSigned*/true,<br>
@@ -975,7 +974,7 @@ Value *llvm::emitFPutS(Value *Str, Value<br>
Module *M = B.GetInsertBlock()->getModule(<wbr>);<br>
StringRef FPutsName = TLI->getName(LibFunc_fputs);<br>
Constant *F = M->getOrInsertFunction(<br>
- FPutsName, B.getInt32Ty(), B.getInt8PtrTy(), File->getType(), nullptr);<br>
+ FPutsName, B.getInt32Ty(), B.getInt8PtrTy(), File->getType());<br>
if (File->getType()->isPointerTy(<wbr>))<br>
inferLibFuncAttributes(*M-><wbr>getFunction(FPutsName), *TLI);<br>
CallInst *CI = B.CreateCall(F, {castToCStr(Str, B), File}, "fputs");<br>
@@ -995,8 +994,8 @@ Value *llvm::emitFWrite(Value *Ptr, Valu<br>
StringRef FWriteName = TLI->getName(LibFunc_fwrite);<br>
Constant *F = M->getOrInsertFunction(<br>
FWriteName, DL.getIntPtrType(Context), B.getInt8PtrTy(),<br>
- DL.getIntPtrType(Context), DL.getIntPtrType(Context), File->getType(),<br>
- nullptr);<br>
+ DL.getIntPtrType(Context), DL.getIntPtrType(Context), File->getType());<br>
+<br>
if (File->getType()->isPointerTy(<wbr>))<br>
inferLibFuncAttributes(*M-><wbr>getFunction(FWriteName), *TLI);<br>
CallInst *CI =<br>
<br>
Modified: llvm/trunk/lib/Transforms/<wbr>Utils/SimplifyLibCalls.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/SimplifyLibCalls.cpp?rev=299949&r1=299948&r2=299949&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/lib/<wbr>Transforms/Utils/<wbr>SimplifyLibCalls.cpp?rev=<wbr>299949&r1=299948&r2=299949&<wbr>view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/lib/Transforms/<wbr>Utils/SimplifyLibCalls.cpp (original)<br>
+++ llvm/trunk/lib/Transforms/<wbr>Utils/SimplifyLibCalls.cpp Tue Apr 11 10:01:18 2017<br>
@@ -819,7 +819,7 @@ static Value *emitCalloc(Value *Num, Val<br>
const DataLayout &DL = M->getDataLayout();<br>
IntegerType *PtrType = DL.getIntPtrType((B.<wbr>GetInsertBlock()->getContext()<wbr>));<br>
Value *Calloc = M->getOrInsertFunction("<wbr>calloc", Attrs, B.getInt8PtrTy(),<br>
- PtrType, PtrType, nullptr);<br>
+ </blockquote></div></div></div></div>
<br>______________________________<wbr>_________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-commits</a><br>
<br></blockquote></div><br></div>