1 ; RUN: opt -passes='print<access-info>' %s -disable-output 2>&1 | FileCheck %s
3 ; This test verifies run-time boundary check of memory accesses.
5 ; void fastCopy(const char* src, char* op) {
8 ; *(reinterpret_cast<long long*>(op)) = *(reinterpret_cast<const long long*>(src));
14 ; Boundaries calculations before this patch:
15 ; (Low: %src High: (24 + %src))
16 ; and the actual distance between two pointers was 31, (%op - %src = 31)
17 ; IsConflict = (24 > 31) = false -> execution is directed to the vectorized loop.
18 ; The loop was vectorized to 4, 32 byte memory access ( <4 x i64> ),
19 ; store a value at *%op touched memory under *%src.
21 ;CHECK: function 'fastCopy':
22 ;CHECK: (Low: %op High: (32 + %op))
23 ;CHECK: (Low: %src High: (32 + %src))
25 define void @fastCopy(ptr nocapture readonly %src, ptr nocapture %op) {
27 br label %while.body.preheader
29 while.body.preheader: ; preds = %entry
32 while.body: ; preds = %while.body.preheader, %while.body
33 %len.addr.07 = phi i32 [ %sub, %while.body ], [ 32, %while.body.preheader ]
34 %op.addr.06 = phi ptr [ %add.ptr1, %while.body ], [ %op, %while.body.preheader ]
35 %src.addr.05 = phi ptr [ %add.ptr, %while.body ], [ %src, %while.body.preheader ]
36 %0 = load i64, ptr %src.addr.05, align 8
37 store i64 %0, ptr %op.addr.06, align 8
38 %add.ptr = getelementptr inbounds i8, ptr %src.addr.05, i64 8
39 %add.ptr1 = getelementptr inbounds i8, ptr %op.addr.06, i64 8
40 %sub = add nsw i32 %len.addr.07, -8
41 %cmp = icmp sgt i32 %len.addr.07, 8
42 br i1 %cmp, label %while.body, label %while.end.loopexit
44 while.end.loopexit: ; preds = %while.body
47 while.end: ; preds = %while.end.loopexit, %entry