1; RUN: opt -passes=print-access-info %s -disable-output 2>&1 | FileCheck %s 2 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. 7 8;CHECK: function 'fastCopy': 9;CHECK: (Low: %op High: (27 + %op)) 10;CHECK: (Low: %src High: (27 + %src)) 11 12define void @fastCopy(i8* nocapture readonly %src, i8* nocapture %op) { 13entry: 14 br label %while.body.preheader 15 16while.body.preheader: ; preds = %entry 17 br label %while.body 18 19while.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 i8* [ %add.ptr1, %while.body ], [ %op, %while.body.preheader ] 22 %src.addr.05 = phi i8* [ %add.ptr, %while.body ], [ %src, %while.body.preheader ] 23 %0 = bitcast i8* %src.addr.05 to i19* 24 %1 = load i19, i19* %0, align 8 25 %2 = bitcast i8* %op.addr.06 to i19* 26 store i19 %1, i19* %2, align 8 27 %add.ptr = getelementptr inbounds i8, i8* %src.addr.05, i19 8 28 %add.ptr1 = getelementptr inbounds i8, i8* %op.addr.06, i19 8 29 %sub = add nsw i32 %len.addr.07, -8 30 %cmp = icmp sgt i32 %len.addr.07, 8 31 br i1 %cmp, label %while.body, label %while.end.loopexit 32 33while.end.loopexit: ; preds = %while.body 34 br label %while.end 35 36while.end: ; preds = %while.end.loopexit, %entry 37 ret void 38} 39