[PATCH] `nonnull` argument attribute.

Philip Reames listmail at philipreames.com
Fri Apr 18 18:12:19 PDT 2014


Good catch.  This is a real corner case in the attribute specification.  
Possibly we should document the distinction somewhere?

Which reminds me, we'll need doc changes (LangRef) to describe the new 
attribute.

Philip

On 04/17/2014 10:43 PM, Hal Finkel wrote:
> ----- Original Message -----
>> From: "Nick Lewycky" <nicholas at mxc.ca>
>> To: reviews+D3389+public+a85d4f162cd7a6e0 at reviews.llvm.org
>> Cc: llvm-commits at cs.uiuc.edu
>> Sent: Thursday, April 17, 2014 10:52:35 PM
>> Subject: Re: [PATCH] `nonnull` argument attribute.
>>
>> Your change to lib/IR/Value.cpp is wrong, a nonnull pointer is not
>> necessarily dereferenceable.
>>
>> %a = inttoptr i32 123456 to i32*
>> call void @foo(i32* %a nonnull)
>>
>> It's nonnull, but not dereferenceable.
> I'll add that we really should have a dereferenceable attribute, IMHO, but as Nick said, it needs to be a separate from notnull. I think that for dereferenceable we'll want to have a more involved discussion because we'll need to decide if it affects derived pointers, should it have a size parameter, etc.
>
>   -Hal
>
>> Nick
>>
>> Luqman Aden wrote:
>>>     Added test.
>>>
>>> http://reviews.llvm.org/D3389
>>>
>>> CHANGE SINCE LAST DIFF
>>>     http://reviews.llvm.org/D3389?vs=8552&id=8553#toc
>>>
>>> Files:
>>>     lib/AsmParser/LLToken.h
>>>     lib/AsmParser/LLParser.cpp
>>>     lib/AsmParser/LLLexer.cpp
>>>     lib/Bitcode/Writer/BitcodeWriter.cpp
>>>     lib/Bitcode/Reader/BitcodeReader.cpp
>>>     lib/IR/Function.cpp
>>>     lib/IR/Attributes.cpp
>>>     lib/Analysis/ValueTracking.cpp
>>>     test/Bitcode/attributes.ll
>>>     test/Analysis/BasicAA/nonnull.ll
>>>     include/llvm/Bitcode/LLVMBitCodes.h
>>>     include/llvm/IR/Attributes.h
>>>     include/llvm/IR/Argument.h
>>>
>>>
>>>
>>> _______________________________________________
>>> llvm-commits mailing list
>>> llvm-commits at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>




More information about the llvm-commits mailing list