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/test/Bitcode | |
| 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/test/Bitcode')
| -rw-r--r-- | llvm/test/Bitcode/compatibility.ll | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/test/Bitcode/compatibility.ll b/llvm/test/Bitcode/compatibility.ll index 7edaa16c748..e2b13f47d3b 100644 --- a/llvm/test/Bitcode/compatibility.ll +++ b/llvm/test/Bitcode/compatibility.ll @@ -1611,6 +1611,13 @@ normal: declare void @f.writeonly() writeonly ; CHECK: declare void @f.writeonly() #39 +;; Constant Expressions + +define i8** @constexpr() { + ; CHECK: ret i8** getelementptr inbounds ({ [4 x i8*], [4 x i8*] }, { [4 x i8*], [4 x i8*] }* null, i32 0, inrange i32 1, i32 2) + ret i8** getelementptr inbounds ({ [4 x i8*], [4 x i8*] }, { [4 x i8*], [4 x i8*] }* null, i32 0, inrange i32 1, i32 2) +} + ; CHECK: attributes #0 = { alignstack=4 } ; CHECK: attributes #1 = { alignstack=8 } ; CHECK: attributes #2 = { alwaysinline } |

