cranelift: Remove redundant branch and select instructions (#5097)
As discussed in the 2022/10/19 meeting, this PR removes many of the branch and select instructions that used iflags, in favor if using brz/brnz and select in their place. Additionally, it reworks selectif_spectre_guard to take an i8 input instead of an iflags input. For reference, the removed instructions are: br_icmp, brif, brff, trueif, trueff, and selectif.
This commit is contained in:
@@ -250,11 +250,11 @@ fn compute_addr(
|
||||
if let Some((cc, a, b)) = spectre_oob_comparison {
|
||||
let final_addr = pos.ins().iadd(base, offset);
|
||||
let zero = pos.ins().iconst(addr_ty, 0);
|
||||
let flags = pos.ins().ifcmp(a, b);
|
||||
let cmp = pos.ins().icmp(cc, a, b);
|
||||
pos.func
|
||||
.dfg
|
||||
.replace(inst)
|
||||
.selectif_spectre_guard(addr_ty, cc, flags, zero, final_addr);
|
||||
.select_spectre_guard(cmp, zero, final_addr);
|
||||
} else {
|
||||
pos.func.dfg.replace(inst).iadd(base, offset);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user