Files
clang-p2996/llvm/test/Transforms/JumpThreading/thread-prob-2.ll
Kazu Hirata 147ccc848a [JumpThreading] Call eraseBlock when folding a conditional branch
This patch teaches the jump threading pass to call BPI->eraseBlock
when it folds a conditional branch.

Without this patch, BranchProbabilityInfo could end up with stale edge
probabilities for the basic block containing the conditional branch --
one edge probability with less than 1.0 and the other for a removed
edge.

This patch is one of the steps before we can safely re-apply D91017.

Differential Revision: https://reviews.llvm.org/D91511
2020-11-15 22:29:30 -08:00

28 lines
570 B
LLVM

; RUN: opt -debug-only=branch-prob -jump-threading -S %s 2>&1 | FileCheck %s
; REQUIRES: asserts
; Make sure that we clear edge probabilities for bb.cond as we fold
; the conditional branch in it.
; CHECK: eraseBlock bb.cond
define i32 @foo(i1 %cond) !prof !0 {
; CHECK-LABEL: @foo
; CHECK: bb.entry:
; CHECK-NEXT: br i1 %cond, label %bb.31, label %bb.12
; CHECK-NOT: bb.cond:
bb.entry:
br i1 %cond, label %bb.31, label %bb.cond
bb.cond:
br i1 %cond, label %bb.31, label %bb.12
bb.31:
ret i32 31
bb.12:
ret i32 12
}
!0 = !{!"function_entry_count", i64 0}