brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.7 KiB · 32c5e76 Raw
68 lines · plain
1; RUN: llc < %s -verify-machineinstrs -no-phi-elim-live-out-early-exit | FileCheck %s2target triple = "x86_64-apple-macosx10.8.0"3 4; The critical edge from for.cond to if.end2 should be split to avoid injecting5; copies into the loop. The use of %b after the loop causes interference that6; makes a copy necessary.7; <rdar://problem/11561842>8;9; CHECK: split_loop_exit10; CHECK: %for.cond11; CHECK-NOT: mov12; CHECK: je13 14define i32 @split_loop_exit(i32 %a, i32 %b, ptr nocapture %p) nounwind uwtable readonly ssp {15entry:16  %cmp = icmp sgt i32 %a, 1017  br i1 %cmp, label %for.cond, label %if.end218 19for.cond:                                         ; preds = %entry, %for.cond20  %p.addr.0 = phi ptr [ %incdec.ptr, %for.cond ], [ %p, %entry ]21  %incdec.ptr = getelementptr inbounds i8, ptr %p.addr.0, i64 122  %0 = load i8, ptr %p.addr.0, align 123  %tobool = icmp eq i8 %0, 024  br i1 %tobool, label %for.cond, label %if.end225 26if.end2:                                          ; preds = %for.cond, %entry27  %r.0 = phi i32 [ %a, %entry ], [ %b, %for.cond ]28  %add = add nsw i32 %r.0, %b29  ret i32 %add30}31 32; CHECK: split_live_out33; CHECK: %while.body34; CHECK: cmp35; CHECK-NEXT: ja36define ptr @split_live_out(i32 %value, ptr %target) nounwind uwtable readonly ssp {37entry:38  %cmp10 = icmp ugt i32 %value, 12739  br i1 %cmp10, label %while.body.preheader, label %while.end40 41while.body.preheader:                             ; preds = %entry42  br label %while.body43 44while.body:                                       ; preds = %while.body.preheader, %while.body45  %target.addr.012 = phi ptr [ %incdec.ptr, %while.body ], [ %target, %while.body.preheader ]46  %value.addr.011 = phi i32 [ %shr, %while.body ], [ %value, %while.body.preheader ]47  %or = or i32 %value.addr.011, 12848  %conv = trunc i32 %or to i849  store i8 %conv, ptr %target.addr.012, align 150  %shr = lshr i32 %value.addr.011, 751  %incdec.ptr = getelementptr inbounds i8, ptr %target.addr.012, i64 152  %cmp = icmp ugt i32 %value.addr.011, 1638353  br i1 %cmp, label %while.body, label %while.end.loopexit54 55while.end.loopexit:                               ; preds = %while.body56  %incdec.ptr.lcssa = phi ptr [ %incdec.ptr, %while.body ]57  %shr.lcssa = phi i32 [ %shr, %while.body ]58  br label %while.end59 60while.end:                                        ; preds = %while.end.loopexit, %entry61  %target.addr.0.lcssa = phi ptr [ %target, %entry ], [ %incdec.ptr.lcssa, %while.end.loopexit ]62  %value.addr.0.lcssa = phi i32 [ %value, %entry ], [ %shr.lcssa, %while.end.loopexit ]63  %conv1 = trunc i32 %value.addr.0.lcssa to i864  store i8 %conv1, ptr %target.addr.0.lcssa, align 165  %incdec.ptr3 = getelementptr inbounds i8, ptr %target.addr.0.lcssa, i64 166  ret ptr %incdec.ptr367}68