111 lines · plain
1; RUN: opt -passes=indvars -S %s | FileCheck %s2;3; PR18384: ValueHandleBase::ValueIsDeleted.4;5; Ensure that LoopSimplify calls ScalarEvolution::forgetLoop before6; deleting a block, regardless of whether any values were hoisted out7; of the block.8 9target datalayout = "e-i64:64-f80:128-n8:16:32:64-S128"10target triple = "x86_64-apple-darwin"11 12%struct.Params = type { [2 x [4 x [16 x i16]]] }13 14; Verify that the loop tail is deleted, and we don't crash!15;16; CHECK-LABEL: @t17; CHECK-LABEL: for.cond127.preheader:18; CHECK-NOT: for.cond127:19; CHECK-LABEL: for.body129:20define void @t(i1 %arg) {21entry:22 br label %for.body10223 24for.body102:25 br i1 %arg, label %for.cond127.preheader, label %for.inc20326 27for.cond127.preheader:28 br label %for.body12929 30for.cond127:31 %cmp128 = icmp slt i32 %inc191, 232 br i1 %cmp128, label %for.body129, label %for.end19233 34for.body129:35 %uv.013 = phi i32 [ 0, %for.cond127.preheader ], [ %inc191, %for.cond127 ]36 %idxprom130 = sext i32 %uv.013 to i6437 br i1 %arg, label %for.cond135.preheader.lr.ph, label %for.end18538 39for.cond135.preheader.lr.ph:40 br i1 %arg, label %for.cond135.preheader.lr.ph.split.us, label %for.cond135.preheader.lr.ph.split_crit_edge41 42for.cond135.preheader.lr.ph.split_crit_edge:43 br label %for.cond135.preheader.lr.ph.split44 45for.cond135.preheader.lr.ph.split.us:46 br label %for.cond135.preheader.us47 48for.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.us51 52for.end178.us:53 %add184.us = add nsw i32 %block_y.09.us, 454 br i1 %arg, label %for.end185split.us-lcssa.us, label %for.cond132.us55 56for.end174.us:57 br i1 %arg, label %for.cond138.preheader.us, label %for.cond135.for.end178_crit_edge.us58 59for.inc172.us:60 br i1 %arg, label %for.cond142.preheader.us, label %for.end174.us61 62for.body145.us:63 %arrayidx163.us = getelementptr inbounds %struct.Params, ptr undef, i64 0, i32 0, i64 %idxprom130, i64 %idxprom146.us64 br i1 %arg, label %for.body145.us, label %for.inc172.us65 66for.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 i6469 br label %for.body145.us70 71for.cond138.preheader.us:72 br label %for.cond142.preheader.us73 74for.cond132.us:75 br i1 %arg, label %for.cond135.preheader.us, label %for.cond132.for.end185_crit_edge.us-lcssa.us76 77for.cond138.preheader.lr.ph.us:78 br label %for.cond138.preheader.us79 80for.cond135.for.end178_crit_edge.us:81 br label %for.end178.us82 83for.end185split.us-lcssa.us:84 br label %for.end185split85 86for.cond132.for.end185_crit_edge.us-lcssa.us:87 br label %for.cond132.for.end185_crit_edge88 89for.cond135.preheader.lr.ph.split:90 br label %for.end185split91 92for.end185split:93 br label %for.end18594 95for.cond132.for.end185_crit_edge:96 br label %for.end18597 98for.end185:99 %inc191 = add nsw i32 %uv.013, 1100 br i1 false, label %for.end192, label %for.cond127101 102for.end192:103 br label %for.inc203104 105for.inc203:106 br label %for.end205107 108for.end205:109 ret void110}111