[PATCH] Reject bitcasts between address spaces with different sizes

Eli Friedman eli.friedman at gmail.com
Tue Jul 2 21:38:57 PDT 2013


On Tue, Jul 2, 2013 at 8:16 PM, Matt Arsenault <Matthew.Arsenault at amd.com>wrote:

> Reject bitcasts between address spaces with different sizes
>
> Autoupgrade from address space bitcasts in existing binaries
> to ptrtoint / inttoptr. This conversion does not happen for
> bitcasts between address spaces with the same pointer size for now.
>
> For bitcode, turn bitcasts from pointers to different address
> spaces into ptrtoint -> inttoptr to the different address space.
>
> For text IR, the module fails verification.
>
> This was discussed a while ago in this thread:
> http://lists.cs.uiuc.edu/pipermail/llvmdev/2012-September/053277.html
>
>
> http://llvm-reviews.chandlerc.com/D1083
>
> Files:
>   docs/LangRef.rst
>   include/llvm/AutoUpgrade.h
>   lib/AsmParser/LLParser.cpp
>   lib/Bitcode/Reader/BitcodeReader.cpp
>   lib/IR/AutoUpgrade.cpp
>   lib/IR/Verifier.cpp
>   test/Bitcode/bitcast-upgrade.ll
>   test/Bitcode/bitcast.ll
>
>
High-level issues:

1. The way this is written, adding a data layout string to a module can
turn a valid module into an invalid module.  We should consider introducing
some sort of safe invariant here (either ban modules without data layouts
outright, or don't allow them to use non-zero address spaces).
2. What are your long-term plans here?  I'm particularly worried about how
you're planning on testing this.

-Eli


On Tue, Jul 2, 2013 at 8:16 PM, Matt Arsenault <Matthew.Arsenault at amd.com>wrote:

> Reject bitcasts between address spaces with different sizes
>
> Autoupgrade from address space bitcasts in existing binaries
> to ptrtoint / inttoptr. This conversion does not happen for
> bitcasts between address spaces with the same pointer size for now.
>
> For bitcode, turn bitcasts from pointers to different address
> spaces into ptrtoint -> inttoptr to the different address space.
>
> For text IR, the module fails verification.
>
> This was discussed a while ago in this thread:
> http://lists.cs.uiuc.edu/pipermail/llvmdev/2012-September/053277.html
>
>
> http://llvm-reviews.chandlerc.com/D1083
>
> Files:
>   docs/LangRef.rst
>   include/llvm/AutoUpgrade.h
>   lib/AsmParser/LLParser.cpp
>   lib/Bitcode/Reader/BitcodeReader.cpp
>   lib/IR/AutoUpgrade.cpp
>   lib/IR/Verifier.cpp
>   test/Bitcode/bitcast-upgrade.ll
>   test/Bitcode/bitcast.ll
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130702/fd4ef2f1/attachment.html>


More information about the llvm-commits mailing list