brintos

brintos / llvm-project-archived public Read only

0
0
Text · 7.9 KiB · a9c9047 Raw
196 lines · plain
1; RUN: llc < %s -mtriple=i686-- -disable-block-placement | FileCheck %s2;3; Test RegistersDefinedFromSameValue. We have multiple copies of the same vreg:4; while.body85.i:5;   %1 = copy %26;   %2 = add7; critical edge from land.lhs.true.i -> if.end117.i:8;   %27 = %29; critical edge from land.lhs.true103.i -> if.end117.i:10;   %27 = %211; if.then108.i:12;   %27 = %113;14; Prior to fixing PR10920 401.bzip miscompile, the coalescer would15; consider %1 and %27 to be copies of the same value. It would16; then remove one of the critical edge copes, which cannot safely be removed.17 18; There are two obvious ways the register-allocator could go here, either19; reusing the pre-addition register later, or the post-addition one. Currently,20; it does the latter, so we check:21 22; CHECK: # %while.body85.i{{$}}23; CHECK-NOT: # %24; CHECK-NOT: add25; CHECK: movl %[[POSTR:e[abcdxi]+]], %[[PRER:e[abcdxi]+]]26; CHECK: addl %{{.*}}, %[[POSTR]]27; CHECK: # %while.end.i28; CHECK-NOT: movl %[[POSTR]]29; CHECK: # %land.lhs.true.i30; CHECK-NOT: movl %[[POSTR]]31; CHECK: # %land.lhs.true103.i32; CHECK-NOT: movl %[[POSTR]]33; CHECK: # %if.then108.i34; CHECK: movl %[[PRER]], %[[POSTR]]35; CHECK: # %if.end117.i36;   and use it for fprintf:37; CHECK: movl %[[POSTR]], 12(%esp)38 39 40; If it ever reverts to reusing the pre-addition register then we should41; *probably* check this instead (it certainly worked last time):42 43; CHECKALT: # %while.body85.i44; CHECKALT-NOT: # %45; CHECKALT-NOT: add46; CHECKALT: movl %[[POSTR:e[abcdxi]+]], %[[PRER:e[abcdxi]+]]47; CHECKALT: addl %{{.*}}, %[[POSTR]]48; CHECKALT: # %while.end.i49; CHECKALT: movl %[[POSTR]], %[[USER:e[abcdxi]+]]50; CHECKALT: # %land.lhs.true.i51; CHECKALT: movl %[[POSTR]], %[[USER]]52; CHECKALT: # %land.lhs.true103.i53; CHECKALT: movl %[[POSTR]], %[[USER]]54; CHECKALT: # %if.then108.i55; [[PRER] live out, so nothing on this path should define it.56; CHECKALT-NOT: , %[[PRER]]57; CHECKALT: # %if.end117.i58 59target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128-n8:16:32"60 61@.str3 = external unnamed_addr constant [59 x i8], align 162 63define void @BZ2_compressBlock() nounwind ssp {64entry:65  br i1 undef, label %if.then68, label %if.end8566 67if.then68:                                        ; preds = %entry68  br label %for.body.i.i69 70for.body.i.i:                                     ; preds = %for.inc.i.i, %if.then6871  br i1 undef, label %for.inc.i.i, label %if.then.i.i72 73if.then.i.i:                                      ; preds = %for.body.i.i74  br label %for.inc.i.i75 76for.inc.i.i:                                      ; preds = %if.then.i.i, %for.body.i.i77  br i1 undef, label %makeMaps_e.exit.i, label %for.body.i.i78 79makeMaps_e.exit.i:                                ; preds = %for.inc.i.i80  br i1 undef, label %for.cond19.preheader.i, label %for.cond.for.cond19.preheader_crit_edge.i81 82for.cond.for.cond19.preheader_crit_edge.i:        ; preds = %makeMaps_e.exit.i83  unreachable84 85for.cond19.preheader.i:                           ; preds = %makeMaps_e.exit.i86  br i1 undef, label %for.body25.lr.ph.i, label %for.cond33.preheader.i87 88for.body25.lr.ph.i:                               ; preds = %for.cond19.preheader.i89  br label %for.body25.i90 91for.cond33.preheader.i:                           ; preds = %for.body25.i, %for.cond19.preheader.i92  br i1 undef, label %if.then.i, label %if.end.i93 94for.body25.i:                                     ; preds = %for.body25.i, %for.body25.lr.ph.i95  br i1 undef, label %for.body25.i, label %for.cond33.preheader.i96 97if.then.i:                                        ; preds = %for.cond33.preheader.i98  br label %if.end.i99 100if.end.i:                                         ; preds = %if.then.i, %for.cond33.preheader.i101  br i1 undef, label %for.inc27.us.5.i, label %for.end30.i102 103for.end30.i:                                      ; preds = %for.inc27.us.5.i, %if.end.i104  br i1 undef, label %if.end36.i, label %if.then35.i105 106if.then35.i:                                      ; preds = %for.end30.i107  unreachable108 109if.end36.i:                                       ; preds = %for.end30.i110  %sub83.i = add nsw i32 undef, 1111  br label %while.body.i188112 113for.cond182.preheader.i:                          ; preds = %for.end173.i114  br i1 undef, label %for.inc220.us.i, label %while.body300.preheader.i115 116while.body.i188:                                  ; preds = %for.end173.i, %if.end36.i117  %gs.0526.i = phi i32 [ 0, %if.end36.i ], [ %add177.i, %for.end173.i ]118  %or.cond514517.i = and i1 false, undef119  br i1 %or.cond514517.i, label %while.body85.i, label %if.end117.i120 121while.body85.i:                                   ; preds = %while.body85.i, %while.body.i188122  %aFreq.0518.i = phi i32 [ %add93.i, %while.body85.i ], [ 0, %while.body.i188 ]123  %inc87.i = add nsw i32 0, 1124  %tmp91.i = load i32, ptr undef, align 4125  %add93.i = add nsw i32 %tmp91.i, %aFreq.0518.i126  %or.cond514.i = and i1 undef, false127  br i1 %or.cond514.i, label %while.body85.i, label %while.end.i128 129while.end.i:                                      ; preds = %while.body85.i130  br i1 undef, label %land.lhs.true.i, label %if.end117.i131 132land.lhs.true.i:                                  ; preds = %while.end.i133  br i1 undef, label %land.lhs.true103.i, label %if.end117.i134 135land.lhs.true103.i:                               ; preds = %land.lhs.true.i136  br i1 undef, label %if.then108.i, label %if.end117.i137 138if.then108.i:                                     ; preds = %land.lhs.true103.i139  br label %if.end117.i140 141if.end117.i:                                      ; preds = %if.then108.i, %land.lhs.true103.i, %land.lhs.true.i, %while.end.i, %while.body.i188142  %aFreq.1.i = phi i32 [ %aFreq.0518.i, %if.then108.i ], [ %add93.i, %land.lhs.true103.i ], [ %add93.i, %land.lhs.true.i ], [ %add93.i, %while.end.i ], [ 0, %while.body.i188 ]143  %ge.1.i = phi i32 [ 0, %if.then108.i ], [ %inc87.i, %land.lhs.true103.i ], [ %inc87.i, %land.lhs.true.i ], [ %inc87.i, %while.end.i ], [ 0, %while.body.i188 ]144  br i1 undef, label %if.then122.i, label %for.cond138.preheader.i145 146if.then122.i:                                     ; preds = %if.end117.i147  call void (...) @fprintf(i32 undef, i32 %gs.0526.i, i32 %ge.1.i, i32 %aFreq.1.i, double undef) nounwind148  br label %for.cond138.preheader.i149 150for.cond138.preheader.i:                          ; preds = %if.then122.i, %if.end117.i151  br i1 undef, label %for.body143.lr.ph.i, label %for.end173.i152 153for.body143.lr.ph.i:                              ; preds = %for.cond138.preheader.i154  br label %for.body143.i155 156for.body143.i:                                    ; preds = %for.body143.i, %for.body143.lr.ph.i157  br i1 undef, label %for.end173.i, label %for.body143.i158 159for.end173.i:                                     ; preds = %for.body143.i, %for.cond138.preheader.i160  %add177.i = add nsw i32 %ge.1.i, 1161  %cmp73.i = icmp sgt i32 undef, 0162  br i1 %cmp73.i, label %while.body.i188, label %for.cond182.preheader.i163 164for.inc220.us.i:                                  ; preds = %for.cond182.preheader.i165  unreachable166 167while.body300.preheader.i:                        ; preds = %for.cond182.preheader.i168  br i1 undef, label %for.end335.i, label %while.end2742.i169 170for.end335.i:                                     ; preds = %for.end2039.i, %while.body300.preheader.i171  br label %for.body2021.i172 173for.body2021.i:                                   ; preds = %for.body2021.i, %for.end335.i174  br i1 undef, label %for.body2021.i, label %for.end2039.i175 176for.end2039.i:                                    ; preds = %for.body2021.i177  br label %for.end335.i178 179while.end2742.i:                                  ; preds = %while.body300.preheader.i180  br i1 undef, label %if.then2748.i, label %for.body2778.i181 182if.then2748.i:                                    ; preds = %while.end2742.i183  unreachable184 185for.body2778.i:                                   ; preds = %while.end2742.i186  unreachable187 188for.inc27.us.5.i:                                 ; preds = %if.end.i189  br label %for.end30.i190 191if.end85:                                         ; preds = %entry192  ret void193}194 195declare void @fprintf(...) nounwind196