1*f4a2713aSLionel Sambuc; RUN: llc < %s -verify-machineinstrs | FileCheck %s 2*f4a2713aSLionel Sambuctarget triple = "x86_64-apple-macosx10.8.0" 3*f4a2713aSLionel Sambuc 4*f4a2713aSLionel Sambuc; The critical edge from for.cond to if.end2 should be split to avoid injecting 5*f4a2713aSLionel Sambuc; copies into the loop. The use of %b after the loop causes interference that 6*f4a2713aSLionel Sambuc; makes a copy necessary. 7*f4a2713aSLionel Sambuc; <rdar://problem/11561842> 8*f4a2713aSLionel Sambuc; 9*f4a2713aSLionel Sambuc; CHECK: split_loop_exit 10*f4a2713aSLionel Sambuc; CHECK: %for.cond 11*f4a2713aSLionel Sambuc; CHECK-NOT: mov 12*f4a2713aSLionel Sambuc; CHECK: je 13*f4a2713aSLionel Sambuc 14*f4a2713aSLionel Sambucdefine i32 @split_loop_exit(i32 %a, i32 %b, i8* nocapture %p) nounwind uwtable readonly ssp { 15*f4a2713aSLionel Sambucentry: 16*f4a2713aSLionel Sambuc %cmp = icmp sgt i32 %a, 10 17*f4a2713aSLionel Sambuc br i1 %cmp, label %for.cond, label %if.end2 18*f4a2713aSLionel Sambuc 19*f4a2713aSLionel Sambucfor.cond: ; preds = %entry, %for.cond 20*f4a2713aSLionel Sambuc %p.addr.0 = phi i8* [ %incdec.ptr, %for.cond ], [ %p, %entry ] 21*f4a2713aSLionel Sambuc %incdec.ptr = getelementptr inbounds i8* %p.addr.0, i64 1 22*f4a2713aSLionel Sambuc %0 = load i8* %p.addr.0, align 1 23*f4a2713aSLionel Sambuc %tobool = icmp eq i8 %0, 0 24*f4a2713aSLionel Sambuc br i1 %tobool, label %for.cond, label %if.end2 25*f4a2713aSLionel Sambuc 26*f4a2713aSLionel Sambucif.end2: ; preds = %for.cond, %entry 27*f4a2713aSLionel Sambuc %r.0 = phi i32 [ %a, %entry ], [ %b, %for.cond ] 28*f4a2713aSLionel Sambuc %add = add nsw i32 %r.0, %b 29*f4a2713aSLionel Sambuc ret i32 %add 30*f4a2713aSLionel Sambuc} 31