1 ; RUN: opt %loadPolly -polly-print-delicm -disable-output < %s | FileCheck %s
3 ; When %b is 0, %for.body13 is an infite loop. In this case the loaded
4 ; value %1 is not used anywhere.
5 ; This is a problem when DeLICM tries to map %1 to %arrayidx16 because
6 ; %1 has no corresponding when %b == 0 and therefore hat no location
7 ; where it can be mapped to. However, since %b == 0 results in an
8 ; infinite loop, it should not in the Context, or in this case, in the
11 ; Test case reduced from llvm.org/PR48445.
13 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
15 @arr_18 = external dso_local local_unnamed_addr global [0 x i16], align 2
17 define void @func(i64 %b, ptr %c) {
19 %conv1 = trunc i64 %b to i32
20 %sext = shl i32 %conv1, 24
21 %conv2 = ashr exact i32 %sext, 24
22 %arrayidx = getelementptr inbounds i8, ptr %c, i64 %b
23 %tobool19.not = icmp eq i64 %b, 0
24 br label %for.cond3.preheader
27 %d.039 = phi i16 [ 0, %entry ], [ %inc, %for.cond.cleanup6 ]
28 %idxprom = sext i16 %d.039 to i64
29 br label %for.cond8.preheader
35 %arrayidx16 = getelementptr inbounds [0 x i16], ptr @arr_18, i64 0, i64 %idxprom
36 %0 = zext i8 %1 to i16
37 store i16 %0, ptr %arrayidx16, align 2
38 %inc = add i16 %d.039, 1
39 %conv = sext i16 %inc to i32
40 %cmp = icmp sgt i32 %conv2, %conv
41 br i1 %cmp, label %for.cond3.preheader, label %for.cond.cleanup
44 br i1 false, label %for.cond8.preheader, label %for.cond.cleanup6
47 %1 = load i8, ptr %arrayidx, align 1
48 br i1 %tobool19.not, label %for.body13, label %for.cond.cleanup12
56 ; CHECK: Value scalars mapped: 1
58 ; CHECK: After accesses {
59 ; CHECK-NEXT: Stmt_for_body13
60 ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
61 ; CHECK-NEXT: [b] -> { Stmt_for_body13[i0, i1, i2] -> MemRef_c[b] };
62 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1]
63 ; CHECK-NEXT: [b] -> { Stmt_for_body13[i0, i1, i2] -> MemRef1[] };
64 ; CHECK-NEXT: new: [b] -> { Stmt_for_body13[i0, i1, i2] -> MemRef_arr_18[i0] : i0 < b; Stmt_for_body13[0, i1, i2] -> MemRef_arr_18[0] : b < 0 };
65 ; CHECK-NEXT: Stmt_for_cond_cleanup6
66 ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 1]
67 ; CHECK-NEXT: [b] -> { Stmt_for_cond_cleanup6[i0] -> MemRef1[] };
68 ; CHECK-NEXT: new: [b] -> { Stmt_for_cond_cleanup6[i0] -> MemRef_arr_18[i0] : i0 < b; Stmt_for_cond_cleanup6[0] -> MemRef_arr_18[0] : b < 0 };
69 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
70 ; CHECK-NEXT: [b] -> { Stmt_for_cond_cleanup6[i0] -> MemRef_arr_18[i0] };