]> granicus.if.org Git - llvm/commit
IR: Introduce inrange attribute on getelementptr indices.
authorPeter Collingbourne <peter@pcc.me.uk>
Thu, 10 Nov 2016 22:34:55 +0000 (22:34 +0000)
committerPeter Collingbourne <peter@pcc.me.uk>
Thu, 10 Nov 2016 22:34:55 +0000 (22:34 +0000)
commitca668e19426e7188ab31d54b53bf33185b65eadd
treeca8098fa7f475387bdf351f75598f31acfc9c779
parentd31cbc45ab39e746ef8d85281ad8debab7ba893f
IR: Introduce inrange attribute on getelementptr indices.

If the inrange keyword is present before any index, loading from or
storing to any pointer derived from the getelementptr has undefined
behavior if the load or store would access memory outside of the bounds of
the element selected by the index marked as inrange.

This can be used, e.g. for alias analysis or to split globals at element
boundaries where beneficial.

As previously proposed on llvm-dev:
http://lists.llvm.org/pipermail/llvm-dev/2016-July/102472.html

Differential Revision: https://reviews.llvm.org/D22793

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286514 91177308-0d34-0410-b5e6-96231b3b80d8
18 files changed:
docs/LangRef.rst
include/llvm/Bitcode/LLVMBitCodes.h
include/llvm/IR/Constants.h
include/llvm/IR/Operator.h
lib/Analysis/ConstantFolding.cpp
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/AsmWriter.cpp
lib/IR/ConstantFold.cpp
lib/IR/ConstantFold.h
lib/IR/Constants.cpp
test/Analysis/ConstantFolding/gep.ll [new file with mode: 0644]
test/Assembler/getelementptr.ll
test/Bitcode/compatibility.ll