Auto merge of #88124 - tmiasko:start-block-critical-edge, r=oli-obk

Split critical edge targeting the start block

Fixes #88043.
This commit is contained in:
bors 2021-08-19 14:35:16 +00:00
commit 2451f42c1d
2 changed files with 13 additions and 1 deletions

View file

@ -38,7 +38,9 @@ impl<'tcx> MirPass<'tcx> for AddCallGuards {
impl AddCallGuards {
pub fn add_call_guards(&self, body: &mut Body<'_>) {
let pred_count: IndexVec<_, _> = body.predecessors().iter().map(|ps| ps.len()).collect();
let mut pred_count: IndexVec<_, _> =
body.predecessors().iter().map(|ps| ps.len()).collect();
pred_count[START_BLOCK] += 1;
// We need a place to store the new blocks generated
let mut new_blocks = Vec::new();

View file

@ -22,4 +22,14 @@ fn take_until(terminate: impl Fn() -> bool) {
// CHECK-LABEL: @main
fn main() {
take_until(|| true);
f(None);
}
fn f(_a: Option<String>) -> Option<u32> {
loop {
g();
()
}
}
fn g() -> Option<u32> { None }