63 lines · plain
1; RUN: opt < %s -passes='print<branch-prob>' -disable-output 2>&1 | FileCheck %s2 3; CHECK-LABEL: no_hoist4; CHECK: edge %entry -> %if.end probability is 0x40000000 / 0x80000000 = 50.00%5; CHECK: edge %entry -> %if.then probability is 0x40000000 / 0x80000000 = 50.00%6; CHECK: edge %if.end -> %if.end4 probability is 0x40000000 / 0x80000000 = 50.00%7; CHECK: edge %if.end -> %if.then3 probability is 0x40000000 / 0x80000000 = 50.00%8define dso_local void @no_hoist(i64 %arg1, i64 %arg2) local_unnamed_addr #0 {9entry:10 %and = and i64 %arg1, 115292150460684697611 %tobool.not = icmp eq i64 %and, 012 br i1 %tobool.not, label %if.end, label %if.then13 14if.then: ; preds = %entry15 tail call void @bar()16 br label %if.end17 18if.end: ; preds = %if.then, %entry19 %and1 = and i64 %arg2, 115292150460684697620 %tobool2.not = icmp eq i64 %and1, 021 br i1 %tobool2.not, label %if.end4, label %if.then322 23if.then3: ; preds = %if.end24 tail call void @baz()25 br label %if.end426 27if.end4: ; preds = %if.then3, %if.end28 ret void29}30 31; CHECK-LABEL: hoist32; CHECK: edge %entry -> %if.end probability is 0x40000000 / 0x80000000 = 50.00%33; CHECK: edge %entry -> %if.then probability is 0x40000000 / 0x80000000 = 50.00%34; CHECK: edge %if.end -> %if.end4 probability is 0x40000000 / 0x80000000 = 50.00%35; CHECK: edge %if.end -> %if.then3 probability is 0x40000000 / 0x80000000 = 50.00%36define dso_local void @hoist(i64 %arg1, i64 %arg2) local_unnamed_addr #0 {37entry:38 %const = bitcast i64 1152921504606846976 to i6439 %and = and i64 %arg1, %const40 %tobool.not = icmp eq i64 %and, 041 br i1 %tobool.not, label %if.end, label %if.then42 43if.then: ; preds = %entry44 tail call void @bar()45 br label %if.end46 47if.end: ; preds = %if.then, %entry48 %and1 = and i64 %arg2, %const49 %tobool2.not = icmp eq i64 %and1, 050 br i1 %tobool2.not, label %if.end4, label %if.then351 52if.then3: ; preds = %if.end53 tail call void @baz()54 br label %if.end455 56if.end4: ; preds = %if.then3, %if.end57 ret void58}59 60declare dso_local void @bar() local_unnamed_addr #161 62declare dso_local void @baz() local_unnamed_addr #163