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