Index: lib/Analysis/BranchProbabilityInfo.cpp =================================================================== --- lib/Analysis/BranchProbabilityInfo.cpp +++ lib/Analysis/BranchProbabilityInfo.cpp @@ -671,10 +671,10 @@ // the successors of a block iteratively. for (auto BB : post_order(&F.getEntryBlock())) { DEBUG(dbgs() << "Computing probabilities for " << BB->getName() << "\n"); - if (calcUnreachableHeuristics(BB)) - continue; if (calcMetadataWeights(BB)) continue; + if (calcUnreachableHeuristics(BB)) + continue; if (calcColdCallHeuristics(BB)) continue; if (calcLoopBranchHeuristics(BB, LI)) Index: test/Analysis/BranchProbabilityInfo/deopt-intrinsic.ll =================================================================== --- test/Analysis/BranchProbabilityInfo/deopt-intrinsic.ll +++ test/Analysis/BranchProbabilityInfo/deopt-intrinsic.ll @@ -19,3 +19,22 @@ exit: ret i32 %b } + +define i32 @test2(i32 %a, i32 %b) { +; CHECK-LABEL: Printing analysis {{.*}} for function 'test2': +entry: + %cond = icmp eq i32 %a, 42 + br i1 %cond, label %exit, label %deopt, !prof !0 + +; CHECK: edge entry -> exit probability is 0x80000000 / 0x80000000 = 100.00% [HOT edge] +; CHECK: edge entry -> deopt probability is 0x00000000 / 0x80000000 = 0.00% + +deopt: + %rval = call i32(...) @llvm.experimental.deoptimize.i32() [ "deopt"() ] + ret i32 %rval + +exit: + ret i32 %b +} + +!0 = !{!"branch_weights", i32 1, i32 0}