77 lines · plain
1; RUN: llc -mtriple=hexagon -ifcvt-limit=0 -hexagon-initial-cfg-cleanup=0 < %s | FileCheck %s2 3; Check if the branch probabilities are reflected in the instructions:4; The basic block placement pass should place the more probable successor5; block as the fall-through block. The unconditional jump in the predecessor6; should then get the right hint (not_taken or ":nt")7 8 9@j = external global i3210 11define i32 @foo(i32 %a) nounwind {12; CHECK: if (!p{{[0-3]}}.new) jump:nt13entry:14 %tobool = icmp eq i32 %a, 015 br i1 %tobool, label %if.else, label %if.then, !prof !016 17if.then: ; preds = %entry18 %add = add nsw i32 %a, 1019 %call = tail call i32 @foobar(i32 %add) nounwind20 br label %return21 22if.else: ; preds = %entry23 %call2 = tail call i32 @foobar(i32 4) nounwind24 br label %return25 26return: ; preds = %if.else, %if.then27 %retval.0 = phi i32 [ %call, %if.then ], [ %call2, %if.else ]28 ret i32 %retval.029}30 31declare i32 @foobar(...)32 33define i32 @bar(i32 %a) nounwind {34; CHECK: if (p{{[0-3]}}.new) jump:nt35entry:36 %tobool = icmp eq i32 %a, 037 br i1 %tobool, label %if.else, label %if.then, !prof !138 39if.then: ; preds = %entry40 %add = add nsw i32 %a, 1041 %call = tail call i32 @foobar(i32 %add) nounwind42 br label %return43 44if.else: ; preds = %entry45 %call2 = tail call i32 @foobar(i32 4) nounwind46 br label %return47 48return: ; preds = %if.else, %if.then49 %retval.0 = phi i32 [ %call, %if.then ], [ %call2, %if.else ]50 ret i32 %retval.051}52 53define i32 @foo_bar(i32 %a, i16 signext %b) nounwind {54; CHECK: if (!cmp.eq(r{{[0-9]*}}.new,#0)) jump:nt55entry:56 %0 = load i32, ptr @j, align 457 %tobool = icmp eq i32 %0, 058 br i1 %tobool, label %if.else, label %if.then, !prof !059 60if.then: ; preds = %entry61 %add = add nsw i32 %a, 1062 %call = tail call i32 @foobar(i32 %add) nounwind63 br label %return64 65if.else: ; preds = %entry66 %add1 = add nsw i32 %a, 467 %call2 = tail call i32 @foobar(i32 %add1) nounwind68 br label %return69 70return: ; preds = %if.else, %if.then71 %retval.0 = phi i32 [ %call, %if.then ], [ %call2, %if.else ]72 ret i32 %retval.073}74 75!0 = !{!"branch_weights", i32 64, i32 4}76!1 = !{!"branch_weights", i32 4, i32 64}77