123 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 62; RUN: opt < %s -disable-output "-passes=print<da>" 2>&1 \3; RUN: | FileCheck %s --check-prefixes=CHECK,CHECK-ALL4; RUN: opt < %s -disable-output "-passes=print<da>" -da-enable-dependence-test=weak-zero-siv 2>&1 \5; RUN: | FileCheck %s --check-prefixes=CHECK,CHECK-WEAK-ZERO-SIV6 7; for (i = 0; i < (1LL << 62); i++) {8; if (0 <= 2*i - 2)9; A[2*i - 2] = 1;10; A[2] = 2;11; }12;13; FIXME: DependenceAnalysis currently detects no dependency between the two14; stores, but it does exist. The root cause is that the product of the BTC and15; the coefficient ((1LL << 62) - 1 and 2) overflows in a signed sense.16;17define void @weakzero_dst_siv_prod_ovfl(ptr %A) {18; CHECK-ALL-LABEL: 'weakzero_dst_siv_prod_ovfl'19; CHECK-ALL-NEXT: Src: store i8 1, ptr %gep.0, align 1 --> Dst: store i8 1, ptr %gep.0, align 120; CHECK-ALL-NEXT: da analyze - none!21; CHECK-ALL-NEXT: Src: store i8 1, ptr %gep.0, align 1 --> Dst: store i8 2, ptr %gep.1, align 122; CHECK-ALL-NEXT: da analyze - none!23; CHECK-ALL-NEXT: Src: store i8 2, ptr %gep.1, align 1 --> Dst: store i8 2, ptr %gep.1, align 124; CHECK-ALL-NEXT: da analyze - consistent output [S]!25;26; CHECK-WEAK-ZERO-SIV-LABEL: 'weakzero_dst_siv_prod_ovfl'27; CHECK-WEAK-ZERO-SIV-NEXT: Src: store i8 1, ptr %gep.0, align 1 --> Dst: store i8 1, ptr %gep.0, align 128; CHECK-WEAK-ZERO-SIV-NEXT: da analyze - consistent output [*]!29; CHECK-WEAK-ZERO-SIV-NEXT: Src: store i8 1, ptr %gep.0, align 1 --> Dst: store i8 2, ptr %gep.1, align 130; CHECK-WEAK-ZERO-SIV-NEXT: da analyze - none!31; CHECK-WEAK-ZERO-SIV-NEXT: Src: store i8 2, ptr %gep.1, align 1 --> Dst: store i8 2, ptr %gep.1, align 132; CHECK-WEAK-ZERO-SIV-NEXT: da analyze - consistent output [S]!33;34entry:35 br label %loop.header36 37loop.header:38 %i = phi i64 [ 0, %entry ], [ %i.inc, %loop.latch ]39 %offset = phi i64 [ -2, %entry ], [ %offset.next, %loop.latch ]40 %ec = icmp eq i64 %i, 461168601842738790441 br i1 %ec, label %exit, label %loop.body42 43loop.body:44 %cond = icmp sge i64 %offset, 045 br i1 %cond, label %if.then, label %loop.latch46 47if.then:48 %gep.0 = getelementptr inbounds i8, ptr %A, i64 %offset49 store i8 1, ptr %gep.050 br label %loop.latch51 52loop.latch:53 %gep.1 = getelementptr inbounds i8, ptr %A, i64 254 store i8 2, ptr %gep.155 %i.inc = add nuw nsw i64 %i, 156 %offset.next = add nsw i64 %offset, 257 br label %loop.header58 59exit:60 ret void61}62 63; for (i = 0; i < n; i++) {64; if (0 <= 2*i - 1)65; A[2*i - 1] = 1;66; A[INT64_MAX] = 2;67; }68;69; FIXME: DependenceAnalysis currently detects no dependency between the two70; stores, but it does exist. When `%n` is 2^62, the value of `%offset` will be71; the same as INT64_MAX at the last iteration.72; The root cause is that the calculation of the difference between the two73; constants (INT64_MAX and -1) overflows in a signed sense.74;75define void @weakzero_dst_siv_delta_ovfl(ptr %A, i64 %n) {76; CHECK-ALL-LABEL: 'weakzero_dst_siv_delta_ovfl'77; CHECK-ALL-NEXT: Src: store i8 1, ptr %gep.0, align 1 --> Dst: store i8 1, ptr %gep.0, align 178; CHECK-ALL-NEXT: da analyze - none!79; CHECK-ALL-NEXT: Src: store i8 1, ptr %gep.0, align 1 --> Dst: store i8 2, ptr %gep.1, align 180; CHECK-ALL-NEXT: da analyze - none!81; CHECK-ALL-NEXT: Src: store i8 2, ptr %gep.1, align 1 --> Dst: store i8 2, ptr %gep.1, align 182; CHECK-ALL-NEXT: da analyze - consistent output [S]!83;84; CHECK-WEAK-ZERO-SIV-LABEL: 'weakzero_dst_siv_delta_ovfl'85; CHECK-WEAK-ZERO-SIV-NEXT: Src: store i8 1, ptr %gep.0, align 1 --> Dst: store i8 1, ptr %gep.0, align 186; CHECK-WEAK-ZERO-SIV-NEXT: da analyze - consistent output [*]!87; CHECK-WEAK-ZERO-SIV-NEXT: Src: store i8 1, ptr %gep.0, align 1 --> Dst: store i8 2, ptr %gep.1, align 188; CHECK-WEAK-ZERO-SIV-NEXT: da analyze - none!89; CHECK-WEAK-ZERO-SIV-NEXT: Src: store i8 2, ptr %gep.1, align 1 --> Dst: store i8 2, ptr %gep.1, align 190; CHECK-WEAK-ZERO-SIV-NEXT: da analyze - consistent output [S]!91;92entry:93 %guard = icmp sgt i64 %n, 094 br i1 %guard, label %loop.header, label %exit95 96loop.header:97 %i = phi i64 [ 0, %entry ], [ %i.inc, %loop.latch ]98 %offset = phi i64 [ -2, %entry ], [ %offset.next, %loop.latch ]99 %ec = icmp eq i64 %i, %n100 br i1 %ec, label %exit, label %loop.body101 102loop.body:103 %cond = icmp sge i64 %offset, 0104 br i1 %cond, label %if.then, label %loop.latch105 106if.then:107 %gep.0 = getelementptr inbounds i8, ptr %A, i64 %offset108 store i8 1, ptr %gep.0109 br label %loop.latch110 111loop.latch:112 %gep.1 = getelementptr inbounds i8, ptr %A, i64 9223372036854775807113 store i8 2, ptr %gep.1114 %i.inc = add nuw nsw i64 %i, 1115 %offset.next = add nsw i64 %offset, 2116 br label %loop.header117 118exit:119 ret void120}121;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:122; CHECK: {{.*}}123