Use layout.last_inst to find 'return' opcodes, rather than iterating.

This commit is contained in:
Tyler McMullen
2017-12-02 17:20:42 -08:00
committed by Jakob Stoklund Olesen
parent 66eccb7859
commit c78a191294

View File

@@ -15,7 +15,7 @@ use self::registers::RU;
use ir; use ir;
use regalloc; use regalloc;
use result; use result;
use ir::{InstBuilder, InstructionData, Opcode}; use ir::InstBuilder;
use ir::immediates::Imm64; use ir::immediates::Imm64;
use stack_layout::layout_stack; use stack_layout::layout_stack;
use cursor::{Cursor, EncCursor}; use cursor::{Cursor, EncCursor};
@@ -207,7 +207,7 @@ impl TargetIsa for Isa {
// Find all 'return' instructions // Find all 'return' instructions
let mut return_insts = Vec::new(); let mut return_insts = Vec::new();
for ebb in func.layout.ebbs() { for ebb in func.layout.ebbs() {
for inst in func.layout.ebb_insts(ebb) { if let Some(inst) = func.layout.last_inst(ebb) {
if func.dfg[inst].opcode().is_return() { if func.dfg[inst].opcode().is_return() {
return_insts.push(inst); return_insts.push(inst);
} }