Add block names to irreducible-control-flow error

This commit is contained in:
Chris Fallin 2023-02-12 13:53:03 -08:00
parent f17164f56f
commit ec2a999359

View file

@ -129,7 +129,13 @@ impl<'a, 'b> Context<'a, 'b> {
log::trace!(" -> succ rpo {}", succ_rpo);
if succ_rpo <= block_rpo {
if !cfg.dominates(succ, block) {
anyhow::bail!("Irreducible control flow: edge from {} to {}", block, succ);
anyhow::bail!(
"Irreducible control flow: edge from {} ({}) to {} ({})",
block,
body.blocks[block].desc,
succ,
body.blocks[succ].desc
);
}
// Backward branch.
loop_headers.insert(succ);