1 ; RUN: opt -indvars -S %s | FileCheck %s
3 ; PR18384: ValueHandleBase::ValueIsDeleted.
5 ; Ensure that LoopSimplify calls ScalarEvolution::forgetLoop before
6 ; deleting a block, regardless of whether any values were hoisted out
9 target datalayout = "e-i64:64-f80:128-n8:16:32:64-S128"
10 target triple = "x86_64-apple-darwin"
12 %struct.Params = type { [2 x [4 x [16 x i16]]] }
14 ; Verify that the loop tail is deleted, and we don't crash!
17 ; CHECK-LABEL: for.cond127.preheader:
18 ; CHECK-NOT: for.cond127:
19 ; CHECK-LABEL: for.body129:
25 br i1 undef, label %for.cond127.preheader, label %for.inc203
27 for.cond127.preheader:
31 %cmp128 = icmp slt i32 %inc191, 2
32 br i1 %cmp128, label %for.body129, label %for.end192
35 %uv.013 = phi i32 [ 0, %for.cond127.preheader ], [ %inc191, %for.cond127 ]
36 %idxprom130 = sext i32 %uv.013 to i64
37 br i1 undef, label %for.cond135.preheader.lr.ph, label %for.end185
39 for.cond135.preheader.lr.ph:
40 br i1 undef, label %for.cond135.preheader.lr.ph.split.us, label %for.cond135.preheader.lr.ph.split_crit_edge
42 for.cond135.preheader.lr.ph.split_crit_edge:
43 br label %for.cond135.preheader.lr.ph.split
45 for.cond135.preheader.lr.ph.split.us:
46 br label %for.cond135.preheader.us
48 for.cond135.preheader.us:
49 %block_y.09.us = phi i32 [ 0, %for.cond135.preheader.lr.ph.split.us ], [ %add184.us, %for.cond132.us ]
50 br i1 true, label %for.cond138.preheader.lr.ph.us, label %for.end178.us
53 %add184.us = add nsw i32 %block_y.09.us, 4
54 br i1 undef, label %for.end185split.us-lcssa.us, label %for.cond132.us
57 br i1 undef, label %for.cond138.preheader.us, label %for.cond135.for.end178_crit_edge.us
60 br i1 undef, label %for.cond142.preheader.us, label %for.end174.us
63 %arrayidx163.us = getelementptr inbounds %struct.Params, %struct.Params* undef, i64 0, i32 0, i64 %idxprom130, i64 %idxprom146.us
64 br i1 undef, label %for.body145.us, label %for.inc172.us
66 for.cond142.preheader.us:
67 %j.04.us = phi i32 [ %block_y.09.us, %for.cond138.preheader.us ], [ undef, %for.inc172.us ]
68 %idxprom146.us = sext i32 %j.04.us to i64
69 br label %for.body145.us
71 for.cond138.preheader.us:
72 br label %for.cond142.preheader.us
75 br i1 undef, label %for.cond135.preheader.us, label %for.cond132.for.end185_crit_edge.us-lcssa.us
77 for.cond138.preheader.lr.ph.us:
78 br label %for.cond138.preheader.us
80 for.cond135.for.end178_crit_edge.us:
81 br label %for.end178.us
83 for.end185split.us-lcssa.us:
84 br label %for.end185split
86 for.cond132.for.end185_crit_edge.us-lcssa.us:
87 br label %for.cond132.for.end185_crit_edge
89 for.cond135.preheader.lr.ph.split:
90 br label %for.end185split
95 for.cond132.for.end185_crit_edge:
99 %inc191 = add nsw i32 %uv.013, 1
100 br i1 false, label %for.end192, label %for.cond127