1 ; RUN: opt -passes='print<access-info>' -disable-output < %s 2>&1 | FileCheck %s
3 ; Test that the loop accesses are proven safe in this case.
4 ; The analyzer uses to be confused by the "diamond" because getUnderlyingObjects
5 ; is saying that the two pointers can both points to null. The loop analyzer
6 ; needs to ignore null in the results returned by getUnderlyingObjects.
8 ; CHECK: Memory dependences are safe with run-time checks
11 ; ModuleID = 'bugpoint-reduced-simplified.bc'
12 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
13 target triple = "x86_64-apple-macosx10.11.0"
15 ; Function Attrs: ssp uwtable
16 define void @foo(i1 %cond, ptr %ptr1, ptr %ptr2) {
17 br i1 %cond, label %.preheader, label %diamond
19 diamond: ; preds = %.noexc.i.i
22 .preheader: ; preds = %diamond, %0
23 %ptr1_or_null = phi ptr [ null, %0 ], [ %ptr1, %diamond ]
24 %ptr2_or_null = phi ptr [ null, %0 ], [ %ptr2, %diamond ]
27 .lr.ph: ; preds = %.lr.ph, %.preheader
28 %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 10, %.preheader ]
29 %indvars.iv.next = add nsw i64 %indvars.iv, -1
30 %tmp4 = getelementptr inbounds i32, ptr %ptr2_or_null, i64 %indvars.iv.next
31 %tmp5 = load i32, ptr %tmp4, align 4
32 %tmp6 = getelementptr inbounds i32, ptr %ptr1_or_null, i64 %indvars.iv.next
33 store i32 undef, ptr %tmp6, align 4
34 br i1 false, label %.lr.ph, label %.end