Declare br_table otherwise ebb as predecessor (#551)

* Declare br_table otherwise ebb as predecessor (fixes #545)
This commit is contained in:
bjorn3
2018-10-10 00:38:16 +02:00
committed by Dan Gohman
parent 7f90414ae1
commit c2069762ef
2 changed files with 83 additions and 2 deletions

View File

@@ -141,7 +141,10 @@ impl<'short, 'long> InstBuilderBase<'short> for FuncInstBuilder<'short, 'long> {
None => {
// branch_destination() doesn't detect jump_tables
// If jump table we declare all entries successor
if let InstructionData::BranchTable { table, .. } = data {
if let InstructionData::BranchTable {
table, destination, ..
} = data
{
// Unlike all other jumps/branches, jump tables are
// capable of having the same successor appear
// multiple times, so we must deduplicate.
@@ -159,8 +162,13 @@ impl<'short, 'long> InstBuilderBase<'short> for FuncInstBuilder<'short, 'long> {
*dest_ebb,
self.builder.position.basic_block.unwrap(),
inst,
)
);
}
self.builder.func_ctx.ssa.declare_ebb_predecessor(
destination,
self.builder.position.basic_block.unwrap(),
inst,
);
}
}
}