1 ; RUN: opt < %s -analyze -basicaa -da | FileCheck %s 2 3 ; ModuleID = 'ZIV.bc' 4 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" 5 target triple = "x86_64-apple-macosx10.6.0" 6 7 8 ;; A[n + 1] = 0; 9 ;; *B = A[1 + n]; 10 11 define void @z0(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp { 12 entry: 13 %add = add i64 %n, 1 14 %arrayidx = getelementptr inbounds i32* %A, i64 %add 15 store i32 0, i32* %arrayidx, align 4 16 17 ; CHECK: da analyze - none! 18 ; CHECK: da analyze - consistent flow [|<]! 19 ; CHECK: da analyze - confused! 20 ; CHECK: da analyze - none! 21 ; CHECK: da analyze - confused! 22 ; CHECK: da analyze - none! 23 24 %add1 = add i64 %n, 1 25 %arrayidx2 = getelementptr inbounds i32* %A, i64 %add1 26 %0 = load i32* %arrayidx2, align 4 27 store i32 %0, i32* %B, align 4 28 ret void 29 } 30 31 32 ;; A[n] = 0; 33 ;; *B = A[n + 1]; 34 35 define void @z1(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp { 36 entry: 37 %arrayidx = getelementptr inbounds i32* %A, i64 %n 38 store i32 0, i32* %arrayidx, align 4 39 40 ; CHECK: da analyze - none! 41 ; CHECK: da analyze - none! 42 ; CHECK: da analyze - confused! 43 ; CHECK: da analyze - none! 44 ; CHECK: da analyze - confused! 45 ; CHECK: da analyze - none! 46 47 %add = add i64 %n, 1 48 %arrayidx1 = getelementptr inbounds i32* %A, i64 %add 49 %0 = load i32* %arrayidx1, align 4 50 store i32 %0, i32* %B, align 4 51 ret void 52 } 53 54 55 ;; A[n] = 0; 56 ;; *B = A[m]; 57 58 define void @z2(i32* %A, i32* %B, i64 %n, i64 %m) nounwind uwtable ssp { 59 entry: 60 %arrayidx = getelementptr inbounds i32* %A, i64 %n 61 store i32 0, i32* %arrayidx, align 4 62 63 ; CHECK: da analyze - none! 64 ; CHECK: da analyze - flow [|<]! 65 ; CHECK: da analyze - confused! 66 ; CHECK: da analyze - none! 67 ; CHECK: da analyze - confused! 68 ; CHECK: da analyze - none! 69 70 %arrayidx1 = getelementptr inbounds i32* %A, i64 %m 71 %0 = load i32* %arrayidx1, align 4 72 store i32 %0, i32* %B, align 4 73 ret void 74 } 75