Split critical edge targeting the start block
This commit is contained in:
parent
d83da1d05d
commit
9a0ee05c3d
2 changed files with 13 additions and 1 deletions
|
@ -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();
|
||||
|
|
|
@ -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 }
|
||||
|
|
Loading…
Add table
Reference in a new issue