diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2016-11-10 22:34:55 +0000 |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2016-11-10 22:34:55 +0000 |
commit | d93620bf4d5e165999ad1c3cec2a2fdb02f56218 (patch) | |
tree | aef2609ce725411649a10eb99701de1eb1bf7843 /llvm/lib/IR/ConstantFold.h | |
parent | a0dee61df34fc819aeb26607bd099ef2ae61c903 (diff) | |
download | bcm5719-llvm-d93620bf4d5e165999ad1c3cec2a2fdb02f56218.tar.gz bcm5719-llvm-d93620bf4d5e165999ad1c3cec2a2fdb02f56218.zip |
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
llvm-svn: 286514
Diffstat (limited to 'llvm/lib/IR/ConstantFold.h')
-rw-r--r-- | llvm/lib/IR/ConstantFold.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/lib/IR/ConstantFold.h b/llvm/lib/IR/ConstantFold.h index 9b0a937c84d..2d8de1132b9 100644 --- a/llvm/lib/IR/ConstantFold.h +++ b/llvm/lib/IR/ConstantFold.h @@ -19,6 +19,8 @@ #ifndef LLVM_LIB_IR_CONSTANTFOLD_H #define LLVM_LIB_IR_CONSTANTFOLD_H +#include "llvm/ADT/Optional.h" + namespace llvm { template <typename T> class ArrayRef; class Value; @@ -46,9 +48,8 @@ template <typename T> class ArrayRef; Constant *V2); Constant *ConstantFoldCompareInstruction(unsigned short predicate, Constant *C1, Constant *C2); - Constant *ConstantFoldGetElementPtr(Type *Ty, Constant *C, bool inBounds, - ArrayRef<Constant *> Idxs); - Constant *ConstantFoldGetElementPtr(Type *Ty, Constant *C, bool inBounds, + Constant *ConstantFoldGetElementPtr(Type *Ty, Constant *C, bool InBounds, + Optional<unsigned> InRangeIndex, ArrayRef<Value *> Idxs); } // End llvm namespace |