brintos

brintos / llvm-project-archived public Read only

0
0
Text · 7.2 KiB · 5dff328 Raw
156 lines · plain
1; RUN: opt -loop-reduce -S < %s | FileCheck %s2;3; <rdar://problem/11049788> Segmentation fault: 11 in LoopStrengthReduce4 5target 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"6target triple = "x86_64-apple-darwin10.0.0"7 8; IVUsers should not consider tmp128 a valid user because it is not in a9; simplified loop nest.10; CHECK-LABEL: @nopreheader(11; CHECK: for.cond:12; CHECK: %tmp128 = add i64 %0, %indvar6513define void @nopreheader(ptr %cmd) nounwind ssp {14entry:15  indirectbr ptr undef, [label %while.cond]16 17while.cond:                                       ; preds = %while.body, %entry18  %0 = phi i64 [ %indvar.next48, %while.body ], [ 0, %entry ]19  indirectbr ptr undef, [label %while.end, label %while.body]20 21while.body:                                       ; preds = %lor.rhs, %lor.lhs.false17, %lor.lhs.false11, %lor.lhs.false, %land.rhs22  %indvar.next48 = add i64 %0, 123  indirectbr ptr undef, [label %while.cond]24 25while.end:                                        ; preds = %lor.rhs, %while.cond26  indirectbr ptr undef, [label %if.end152]27 28if.end152:                                        ; preds = %lor.lhs.false144, %if.end11029  indirectbr ptr undef, [label %lor.lhs.false184, label %for.cond]30 31lor.lhs.false184:                                 ; preds = %lor.lhs.false17732  indirectbr ptr undef, [label %return, label %for.cond]33 34for.cond:                                         ; preds = %for.inc, %lor.lhs.false184, %if.end15235  %indvar65 = phi i64 [ %indvar.next66, %for.inc ], [ 0, %lor.lhs.false184 ], [ 0, %if.end152 ]36  %tmp128 = add i64 %0, %indvar6537  %s.4 = getelementptr i8, ptr %cmd, i64 %tmp12838  %tmp195 = load i8, ptr %s.4, align 139  indirectbr ptr undef, [label %return, label %land.rhs198]40 41land.rhs198:                                      ; preds = %for.cond42  indirectbr ptr undef, [label %return, label %for.inc]43 44for.inc:                                          ; preds = %lor.rhs234, %land.lhs.true228, %land.lhs.true216, %land.lhs.true20445  %indvar.next66 = add i64 %indvar65, 146  indirectbr ptr undef, [label %for.cond]47 48return:                                           ; preds = %if.end677, %doshell, %if.then9649  ret void50}51 52; Another case with a dominating loop that does not contain the IV53; User. Just make sure it doesn't assert.54define void @nopreheader2() nounwind ssp {55entry:56  indirectbr ptr undef, [label %while.cond, label %return]57 58while.cond:                                       ; preds = %while.cond.backedge, %entry59  indirectbr ptr undef, [label %while.cond.backedge, label %lor.rhs]60 61lor.rhs:                                          ; preds = %while.cond62  indirectbr ptr undef, [label %while.cond.backedge, label %while.end]63 64while.cond.backedge:                              ; preds = %lor.rhs, %while.cond65  indirectbr ptr undef, [label %while.cond]66 67while.end:                                        ; preds = %lor.rhs68  indirectbr ptr undef, [label %if.then18, label %return]69 70if.then18:                                        ; preds = %while.end71  indirectbr ptr undef, [label %if.end35, label %lor.lhs.false]72 73lor.lhs.false:                                    ; preds = %if.then1874  indirectbr ptr undef, [label %if.end35, label %return]75 76if.end35:                                         ; preds = %lor.lhs.false, %if.then1877  indirectbr ptr undef, [label %while.cond36]78 79while.cond36:                                     ; preds = %while.body49, %if.end3580  %0 = phi i64 [ %indvar.next13, %while.body49 ], [ 0, %if.end35 ]81  indirectbr ptr undef, [label %while.body49, label %lor.rhs42]82 83lor.rhs42:                                        ; preds = %while.cond3684  indirectbr ptr undef, [label %while.body49, label %while.end52]85 86while.body49:                                     ; preds = %lor.rhs42, %while.cond3687  %indvar.next13 = add i64 %0, 188  indirectbr ptr undef, [label %while.cond36]89 90while.end52:                                      ; preds = %lor.rhs4291  indirectbr ptr undef, [label %land.lhs.true, label %return]92 93land.lhs.true:                                    ; preds = %while.end5294  indirectbr ptr undef, [label %while.cond66.preheader, label %return]95 96while.cond66.preheader:                           ; preds = %land.lhs.true97  indirectbr ptr undef, [label %while.cond66]98 99while.cond66:                                     ; preds = %while.body77, %while.cond66.preheader100  indirectbr ptr undef, [label %land.rhs, label %while.cond81.preheader]101 102land.rhs:                                         ; preds = %while.cond66103  indirectbr ptr undef, [label %while.body77, label %while.cond81.preheader]104 105while.cond81.preheader:                           ; preds = %land.rhs, %while.cond66106  %tmp45 = add i64 undef, %0107  %tmp46 = add i64 %tmp45, undef108  indirectbr ptr undef, [label %while.cond81]109 110while.body77:                                     ; preds = %land.rhs111  indirectbr ptr undef, [label %while.cond66]112 113while.cond81:                                     ; preds = %while.body94, %while.cond81.preheader114  %tmp25 = add i64 %tmp46, undef115  indirectbr ptr undef, [label %while.body94, label %lor.rhs87]116 117lor.rhs87:                                        ; preds = %while.cond81118  indirectbr ptr undef, [label %while.body94, label %return]119 120while.body94:                                     ; preds = %lor.rhs87, %while.cond81121  indirectbr ptr undef, [label %while.cond81]122 123return:                                           ; preds = %if.end216, %land.lhs.true183, %land.lhs.true, %while.end52, %lor.lhs.false, %while.end, %entry124  ret void125}126 127; Test a phi operand IV User dominated by a no-preheader loop.128define void @nopreheader3() nounwind uwtable ssp align 2 {129entry:130  indirectbr ptr blockaddress(@nopreheader3, %if.end10), [label %if.end22, label %if.end10]131 132if.end10:                                         ; preds = %entry133  indirectbr ptr blockaddress(@nopreheader3, %if.end6.i), [label %if.end22, label %if.end6.i]134 135if.end6.i:                                        ; preds = %if.end10136  indirectbr ptr blockaddress(@nopreheader3, %while.cond2.preheader.i.i), [label %if.then12, label %while.cond2.preheader.i.i]137 138while.cond2.preheader.i.i:                        ; preds = %while.end.i18.i, %if.end6.i139  indirectbr ptr blockaddress(@nopreheader3, %while.cond2.i.i), [label %while.cond2.i.i]140 141while.cond2.i.i:                                  ; preds = %while.cond2.i.i, %while.cond2.preheader.i.i142  %i1.1.i14.i = phi i32 [ %add.i15.i, %while.cond2.i.i ], [ undef, %while.cond2.preheader.i.i ]143  %add.i15.i = add nsw i32 %i1.1.i14.i, undef144  indirectbr ptr blockaddress(@nopreheader3, %while.end.i18.i), [label %while.cond2.i.i, label %while.end.i18.i]145 146while.end.i18.i:                                  ; preds = %while.cond2.i.i147  indirectbr ptr blockaddress(@nopreheader3, %while.cond2.preheader.i.i), [label %if.then12, label %while.cond2.preheader.i.i]148 149if.then12:                                        ; preds = %while.end.i18.i, %if.end6.i150  %i1.0.lcssa.i.i = phi i32 [ undef, %if.end6.i ], [ %i1.1.i14.i, %while.end.i18.i ]151  indirectbr ptr blockaddress(@nopreheader3, %if.end22), [label %if.end22]152 153if.end22:                                         ; preds = %if.then12, %if.end10, %entry154  ret void155}156