| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423 |
- ; RUN: opt < %s -analyze -basicaa -da | FileCheck %s
- ; ModuleID = 'SymbolicSIV.bc'
- 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"
- target triple = "x86_64-apple-macosx10.6.0"
- ;; for (long int i = 0; i < n; i++) {
- ;; A[2*i + n] = i;
- ;; *B++ = A[3*i + 3*n];
- define void @symbolicsiv0(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
- entry:
- %cmp1 = icmp eq i64 %n, 0
- br i1 %cmp1, label %for.end, label %for.body.preheader
- ; CHECK: da analyze - none!
- ; CHECK: da analyze - none!
- ; CHECK: da analyze - confused!
- ; CHECK: da analyze - none!
- ; CHECK: da analyze - confused!
- ; CHECK: da analyze - none!
- for.body.preheader: ; preds = %entry
- br label %for.body
- for.body: ; preds = %for.body.preheader, %for.body
- %i.03 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
- %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %for.body.preheader ]
- %conv = trunc i64 %i.03 to i32
- %mul = shl nsw i64 %i.03, 1
- %add = add i64 %mul, %n
- %arrayidx = getelementptr inbounds i32, i32* %A, i64 %add
- store i32 %conv, i32* %arrayidx, align 4
- %mul14 = add i64 %i.03, %n
- %add3 = mul i64 %mul14, 3
- %arrayidx4 = getelementptr inbounds i32, i32* %A, i64 %add3
- %0 = load i32, i32* %arrayidx4, align 4
- %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.02, i64 1
- store i32 %0, i32* %B.addr.02, align 4
- %inc = add nsw i64 %i.03, 1
- %exitcond = icmp ne i64 %inc, %n
- br i1 %exitcond, label %for.body, label %for.end.loopexit
- for.end.loopexit: ; preds = %for.body
- br label %for.end
- for.end: ; preds = %for.end.loopexit, %entry
- ret void
- }
- ;; for (long int i = 0; i < n; i++) {
- ;; A[2*i + 5*n] = i;
- ;; *B++ = A[3*i + 2*n];
- define void @symbolicsiv1(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
- entry:
- %cmp1 = icmp eq i64 %n, 0
- br i1 %cmp1, label %for.end, label %for.body.preheader
- ; CHECK: da analyze - none!
- ; CHECK: da analyze - none!
- ; CHECK: da analyze - confused!
- ; CHECK: da analyze - none!
- ; CHECK: da analyze - confused!
- ; CHECK: da analyze - none!
- for.body.preheader: ; preds = %entry
- br label %for.body
- for.body: ; preds = %for.body.preheader, %for.body
- %i.03 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
- %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %for.body.preheader ]
- %conv = trunc i64 %i.03 to i32
- %mul = shl nsw i64 %i.03, 1
- %mul1 = mul i64 %n, 5
- %add = add i64 %mul, %mul1
- %arrayidx = getelementptr inbounds i32, i32* %A, i64 %add
- store i32 %conv, i32* %arrayidx, align 4
- %mul2 = mul nsw i64 %i.03, 3
- %mul3 = shl i64 %n, 1
- %add4 = add i64 %mul2, %mul3
- %arrayidx5 = getelementptr inbounds i32, i32* %A, i64 %add4
- %0 = load i32, i32* %arrayidx5, align 4
- %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.02, i64 1
- store i32 %0, i32* %B.addr.02, align 4
- %inc = add nsw i64 %i.03, 1
- %exitcond = icmp ne i64 %inc, %n
- br i1 %exitcond, label %for.body, label %for.end.loopexit
- for.end.loopexit: ; preds = %for.body
- br label %for.end
- for.end: ; preds = %for.end.loopexit, %entry
- ret void
- }
- ;; for (long int i = 0; i < n; i++) {
- ;; A[2*i - n] = i;
- ;; *B++ = A[-i + 2*n];
- define void @symbolicsiv2(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
- entry:
- %cmp1 = icmp eq i64 %n, 0
- br i1 %cmp1, label %for.end, label %for.body.preheader
- ; CHECK: da analyze - none!
- ; CHECK: da analyze - none!
- ; CHECK: da analyze - confused!
- ; CHECK: da analyze - none!
- ; CHECK: da analyze - confused!
- ; CHECK: da analyze - none!
- for.body.preheader: ; preds = %entry
- br label %for.body
- for.body: ; preds = %for.body.preheader, %for.body
- %i.03 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
- %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %for.body.preheader ]
- %conv = trunc i64 %i.03 to i32
- %mul = shl nsw i64 %i.03, 1
- %sub = sub i64 %mul, %n
- %arrayidx = getelementptr inbounds i32, i32* %A, i64 %sub
- store i32 %conv, i32* %arrayidx, align 4
- %mul2 = shl i64 %n, 1
- %add = sub i64 %mul2, %i.03
- %arrayidx3 = getelementptr inbounds i32, i32* %A, i64 %add
- %0 = load i32, i32* %arrayidx3, align 4
- %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.02, i64 1
- store i32 %0, i32* %B.addr.02, align 4
- %inc = add nsw i64 %i.03, 1
- %exitcond = icmp ne i64 %inc, %n
- br i1 %exitcond, label %for.body, label %for.end.loopexit
- for.end.loopexit: ; preds = %for.body
- br label %for.end
- for.end: ; preds = %for.end.loopexit, %entry
- ret void
- }
- ;; for (long int i = 0; i < n; i++) {
- ;; A[-2*i + n + 1] = i;
- ;; *B++ = A[i - 2*n];
- define void @symbolicsiv3(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
- entry:
- %cmp1 = icmp eq i64 %n, 0
- br i1 %cmp1, label %for.end, label %for.body.preheader
- ; CHECK: da analyze - none!
- ; CHECK: da analyze - none!
- ; CHECK: da analyze - confused!
- ; CHECK: da analyze - none!
- ; CHECK: da analyze - confused!
- ; CHECK: da analyze - none!
- for.body.preheader: ; preds = %entry
- br label %for.body
- for.body: ; preds = %for.body.preheader, %for.body
- %i.03 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
- %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %for.body.preheader ]
- %conv = trunc i64 %i.03 to i32
- %mul = mul nsw i64 %i.03, -2
- %add = add i64 %mul, %n
- %add1 = add i64 %add, 1
- %arrayidx = getelementptr inbounds i32, i32* %A, i64 %add1
- store i32 %conv, i32* %arrayidx, align 4
- %mul2 = shl i64 %n, 1
- %sub = sub i64 %i.03, %mul2
- %arrayidx3 = getelementptr inbounds i32, i32* %A, i64 %sub
- %0 = load i32, i32* %arrayidx3, align 4
- %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.02, i64 1
- store i32 %0, i32* %B.addr.02, align 4
- %inc = add nsw i64 %i.03, 1
- %exitcond = icmp ne i64 %inc, %n
- br i1 %exitcond, label %for.body, label %for.end.loopexit
- for.end.loopexit: ; preds = %for.body
- br label %for.end
- for.end: ; preds = %for.end.loopexit, %entry
- ret void
- }
- ;; for (long int i = 0; i < n; i++) {
- ;; A[-2*i + 3*n] = i;
- ;; *B++ = A[-i + n];
- define void @symbolicsiv4(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
- entry:
- %cmp1 = icmp eq i64 %n, 0
- br i1 %cmp1, label %for.end, label %for.body.preheader
- ; CHECK: da analyze - none!
- ; CHECK: da analyze - none!
- ; CHECK: da analyze - confused!
- ; CHECK: da analyze - none!
- ; CHECK: da analyze - confused!
- ; CHECK: da analyze - none!
- for.body.preheader: ; preds = %entry
- br label %for.body
- for.body: ; preds = %for.body.preheader, %for.body
- %i.03 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
- %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %for.body.preheader ]
- %conv = trunc i64 %i.03 to i32
- %mul = mul nsw i64 %i.03, -2
- %mul1 = mul i64 %n, 3
- %add = add i64 %mul, %mul1
- %arrayidx = getelementptr inbounds i32, i32* %A, i64 %add
- store i32 %conv, i32* %arrayidx, align 4
- %add2 = sub i64 %n, %i.03
- %arrayidx3 = getelementptr inbounds i32, i32* %A, i64 %add2
- %0 = load i32, i32* %arrayidx3, align 4
- %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.02, i64 1
- store i32 %0, i32* %B.addr.02, align 4
- %inc = add nsw i64 %i.03, 1
- %exitcond = icmp ne i64 %inc, %n
- br i1 %exitcond, label %for.body, label %for.end.loopexit
- for.end.loopexit: ; preds = %for.body
- br label %for.end
- for.end: ; preds = %for.end.loopexit, %entry
- ret void
- }
- ;; for (long int i = 0; i < n; i++) {
- ;; A[-2*i - 2*n] = i;
- ;; *B++ = A[-i - n];
- define void @symbolicsiv5(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
- entry:
- %cmp1 = icmp eq i64 %n, 0
- br i1 %cmp1, label %for.end, label %for.body.preheader
- ; CHECK: da analyze - none!
- ; CHECK: da analyze - none!
- ; CHECK: da analyze - confused!
- ; CHECK: da analyze - none!
- ; CHECK: da analyze - confused!
- ; CHECK: da analyze - none!
- for.body.preheader: ; preds = %entry
- br label %for.body
- for.body: ; preds = %for.body.preheader, %for.body
- %i.03 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
- %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %for.body.preheader ]
- %conv = trunc i64 %i.03 to i32
- %mul = mul nsw i64 %i.03, -2
- %mul1 = shl i64 %n, 1
- %sub = sub i64 %mul, %mul1
- %arrayidx = getelementptr inbounds i32, i32* %A, i64 %sub
- store i32 %conv, i32* %arrayidx, align 4
- %sub2 = sub nsw i64 0, %i.03
- %sub3 = sub i64 %sub2, %n
- %arrayidx4 = getelementptr inbounds i32, i32* %A, i64 %sub3
- %0 = load i32, i32* %arrayidx4, align 4
- %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.02, i64 1
- store i32 %0, i32* %B.addr.02, align 4
- %inc = add nsw i64 %i.03, 1
- %exitcond = icmp ne i64 %inc, %n
- br i1 %exitcond, label %for.body, label %for.end.loopexit
- for.end.loopexit: ; preds = %for.body
- br label %for.end
- for.end: ; preds = %for.end.loopexit, %entry
- ret void
- }
- ;; why doesn't SCEV package understand that n >= 0?
- ;; for (long unsigned i = 0; i < n; i++) {
- ;; A[i + n + 1] = i;
- ;; *B++ = A[-i];
- define void @weaktest(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
- entry:
- %cmp1 = icmp eq i64 %n, 0
- br i1 %cmp1, label %for.end, label %for.body.preheader
- ; CHECK: da analyze - none!
- ; CHECK: da analyze - flow [*|<] splitable!
- ; CHECK: da analyze - split level = 1, iteration = ((0 smax (-1 + (-1 * %n))) /u 2)!
- ; CHECK: da analyze - confused!
- ; CHECK: da analyze - none!
- ; CHECK: da analyze - confused!
- ; CHECK: da analyze - none!
- for.body.preheader: ; preds = %entry
- br label %for.body
- for.body: ; preds = %for.body.preheader, %for.body
- %i.03 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
- %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %for.body.preheader ]
- %conv = trunc i64 %i.03 to i32
- %add = add i64 %i.03, %n
- %add1 = add i64 %add, 1
- %arrayidx = getelementptr inbounds i32, i32* %A, i64 %add1
- store i32 %conv, i32* %arrayidx, align 4
- %sub = sub i64 0, %i.03
- %arrayidx2 = getelementptr inbounds i32, i32* %A, i64 %sub
- %0 = load i32, i32* %arrayidx2, align 4
- %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.02, i64 1
- store i32 %0, i32* %B.addr.02, align 4
- %inc = add i64 %i.03, 1
- %exitcond = icmp ne i64 %inc, %n
- br i1 %exitcond, label %for.body, label %for.end.loopexit
- for.end.loopexit: ; preds = %for.body
- br label %for.end
- for.end: ; preds = %for.end.loopexit, %entry
- ret void
- }
- ;; for (long int i = 0; i < n; i++) {
- ;; A[4*N*i + M] = i;
- ;; *B++ = A[4*N*i + 3*M + 1];
- define void @symbolicsiv6(i32* %A, i32* %B, i64 %n, i64 %N, i64 %M) nounwind uwtable ssp {
- entry:
- %cmp1 = icmp eq i64 %n, 0
- br i1 %cmp1, label %for.end, label %for.body.preheader
- ; CHECK: da analyze - none!
- ; CHECK: da analyze - none!
- ; CHECK: da analyze - confused!
- ; CHECK: da analyze - none!
- ; CHECK: da analyze - confused!
- ; CHECK: da analyze - none!
- for.body.preheader: ; preds = %entry
- br label %for.body
- for.body: ; preds = %for.body.preheader, %for.body
- %i.03 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
- %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %for.body.preheader ]
- %conv = trunc i64 %i.03 to i32
- %mul = shl i64 %N, 2
- %mul1 = mul i64 %mul, %i.03
- %add = add i64 %mul1, %M
- %arrayidx = getelementptr inbounds i32, i32* %A, i64 %add
- store i32 %conv, i32* %arrayidx, align 4
- %mul2 = shl i64 %N, 2
- %mul3 = mul i64 %mul2, %i.03
- %mul4 = mul i64 %M, 3
- %add5 = add i64 %mul3, %mul4
- %add6 = add i64 %add5, 1
- %arrayidx7 = getelementptr inbounds i32, i32* %A, i64 %add6
- %0 = load i32, i32* %arrayidx7, align 4
- %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.02, i64 1
- store i32 %0, i32* %B.addr.02, align 4
- %inc = add nsw i64 %i.03, 1
- %exitcond = icmp ne i64 %inc, %n
- br i1 %exitcond, label %for.body, label %for.end.loopexit
- for.end.loopexit: ; preds = %for.body
- br label %for.end
- for.end: ; preds = %for.end.loopexit, %entry
- ret void
- }
- ;; for (long int i = 0; i < n; i++) {
- ;; A[2*N*i + M] = i;
- ;; *B++ = A[2*N*i - 3*M + 2];
- define void @symbolicsiv7(i32* %A, i32* %B, i64 %n, i64 %N, i64 %M) nounwind uwtable ssp {
- entry:
- %cmp1 = icmp eq i64 %n, 0
- br i1 %cmp1, label %for.end, label %for.body.preheader
- ; CHECK: da analyze - none!
- ; CHECK: da analyze - flow [<>]!
- ; CHECK: da analyze - confused!
- ; CHECK: da analyze - none!
- ; CHECK: da analyze - confused!
- ; CHECK: da analyze - none!
- for.body.preheader: ; preds = %entry
- br label %for.body
- for.body: ; preds = %for.body.preheader, %for.body
- %i.03 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
- %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %for.body.preheader ]
- %conv = trunc i64 %i.03 to i32
- %mul = shl i64 %N, 1
- %mul1 = mul i64 %mul, %i.03
- %add = add i64 %mul1, %M
- %arrayidx = getelementptr inbounds i32, i32* %A, i64 %add
- store i32 %conv, i32* %arrayidx, align 4
- %mul2 = shl i64 %N, 1
- %mul3 = mul i64 %mul2, %i.03
- %0 = mul i64 %M, -3
- %sub = add i64 %mul3, %0
- %add5 = add i64 %sub, 2
- %arrayidx6 = getelementptr inbounds i32, i32* %A, i64 %add5
- %1 = load i32, i32* %arrayidx6, align 4
- %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.02, i64 1
- store i32 %1, i32* %B.addr.02, align 4
- %inc = add nsw i64 %i.03, 1
- %exitcond = icmp ne i64 %inc, %n
- br i1 %exitcond, label %for.body, label %for.end.loopexit
- for.end.loopexit: ; preds = %for.body
- br label %for.end
- for.end: ; preds = %for.end.loopexit, %entry
- ret void
- }
|