summaryrefslogtreecommitdiff
path: root/test/Bitcode/compatibility.ll
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2016-11-10 22:34:55 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2016-11-10 22:34:55 +0000
commitca668e19426e7188ab31d54b53bf33185b65eadd (patch)
treeca8098fa7f475387bdf351f75598f31acfc9c779 /test/Bitcode/compatibility.ll
parentd31cbc45ab39e746ef8d85281ad8debab7ba893f (diff)
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
Diffstat (limited to 'test/Bitcode/compatibility.ll')
-rw-r--r--test/Bitcode/compatibility.ll7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/Bitcode/compatibility.ll b/test/Bitcode/compatibility.ll
index 7edaa16c748..e2b13f47d3b 100644
--- a/test/Bitcode/compatibility.ll
+++ b/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 }