[PATCH] [IR] Introduce a dereferenceable_xor_null(N) attribute.
Sanjoy Das
sanjoy at playingwithpointers.com
Thu Mar 26 22:33:54 PDT 2015
On Thu, Mar 26, 2015 at 10:23 PM, Nick Lewycky <nicholas at mxc.ca> wrote:
> Sanjoy Das wrote:
>>
>> Hi hfinkel, rafael,
>>
>> If a pointer is marked as dereferenceable_xor_null(N), LLVM assumes it
>> is exactly one of { null, dereferenceable(N) }.
>
>
> Painting the bike shed ... I dislike the name so much I'd rather you changed
> "dereferenceable" to mean this, and then allow people to apply "nonnull"
> with dereferenceable to get the current meaning of deferenceable. Changing
Only for address space 0. For address spaces where null is
dereferenceable deriving dereferenceable using nonnull is not viable.
> the meaning of the existing attribute is less bad. (I also think that it's
> strict a loosening of the guarantees that dereferenceable offers, so using
> older .ll/.bc files with newer llvm will work, with loss of optimization
> opportunity in the worst case. That's fine.)
I have no problems with this (I think the null-is-dereferenceable case
is fairly esoteric), but Hal did in the earlier thread I linked to, so
I will wait for him to chime in on this.
> Also pointers returned by malloc. LibCallSimplifier::optimizeCall annotates
> known functions with attributes, please add that there to anything that it
> applies to.
Will do.
>
>>
>> http://reviews.llvm.org/D8650
>>
>> Files:
>> docs/LangRef.rst
>> include/llvm-c/Core.h
>> include/llvm/Bitcode/LLVMBitCodes.h
>> include/llvm/IR/Attributes.h
>> include/llvm/IR/Function.h
>> include/llvm/IR/Instructions.h
>> lib/AsmParser/LLLexer.cpp
>> lib/AsmParser/LLParser.cpp
>> lib/AsmParser/LLParser.h
>> lib/AsmParser/LLToken.h
>> lib/Bitcode/Reader/BitcodeReader.cpp
>> lib/Bitcode/Writer/BitcodeWriter.cpp
>> lib/IR/AttributeImpl.h
>> lib/IR/Attributes.cpp
>> lib/IR/Function.cpp
>> lib/IR/Instructions.cpp
>> test/Assembler/deref-xor-null.ll
>>
>> EMAIL PREFERENCES
>> http://reviews.llvm.org/settings/panel/emailpreferences/
>>
>>
>>
>> _______________________________________________
>> 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