1 ; RUN: opt -passes='print<access-info>' %s -disable-output 2>&1 | FileCheck %s
3 ; This test defends against accidentally using alloc size instead of store size when performing run-time
4 ; boundary check of memory accesses. The IR in this file is based on
5 ; llvm/test/Analysis/LoopAccessAnalysis/memcheck-off-by-one-error.ll.
6 ; Here, we use i19 instead of i64 because it has a different alloc size to its store size.
8 ;CHECK: function 'fastCopy':
9 ;CHECK: (Low: %op High: (27 + %op))
10 ;CHECK: (Low: %src High: (27 + %src))
12 define void @fastCopy(ptr nocapture readonly %src, ptr nocapture %op) {
14 br label %while.body.preheader
16 while.body.preheader: ; preds = %entry
19 while.body: ; preds = %while.body.preheader, %while.body
20 %len.addr.07 = phi i32 [ %sub, %while.body ], [ 32, %while.body.preheader ]
21 %op.addr.06 = phi ptr [ %add.ptr1, %while.body ], [ %op, %while.body.preheader ]
22 %src.addr.05 = phi ptr [ %add.ptr, %while.body ], [ %src, %while.body.preheader ]
23 %0 = load i19, ptr %src.addr.05, align 8
24 store i19 %0, ptr %op.addr.06, align 8
25 %add.ptr = getelementptr inbounds i8, ptr %src.addr.05, i19 8
26 %add.ptr1 = getelementptr inbounds i8, ptr %op.addr.06, i19 8
27 %sub = add nsw i32 %len.addr.07, -8
28 %cmp = icmp sgt i32 %len.addr.07, 8
29 br i1 %cmp, label %while.body, label %while.end.loopexit
31 while.end.loopexit: ; preds = %while.body
34 while.end: ; preds = %while.end.loopexit, %entry