Merge pull request #2843 from uweigand/spillslot-fix

cranelift: Fix spillslot regression on big-endian platforms
This commit is contained in:
Chris Fallin
2021-04-15 13:28:33 -07:00
committed by GitHub
2 changed files with 10 additions and 1 deletions

View File

@@ -1209,6 +1209,15 @@ impl<M: ABIMachineSpec> ABICallee for ABICalleeImpl<M> {
let spill_off = islot * M::word_bytes() as i64;
let sp_off = self.stackslots_size as i64 + spill_off;
trace!("load_spillslot: slot {:?} -> sp_off {}", slot, sp_off);
// Integer types smaller than word size have been spilled as words below,
// and therefore must be reloaded in the same type.
let ty = if ty.is_int() && ty.bytes() < M::word_bytes() {
M::word_type()
} else {
ty
};
gen_load_stack_multi::<M>(StackAMode::NominalSPOffset(sp_off, ty), into_regs, ty)
}

View File

@@ -51,7 +51,7 @@ block0(v0: i32, v1: i32, v2: i32):
;; This should be movq below, not movl.
; nextln: movq %rsi, rsp(0 + virtual offset)
; nextln: movslq rsp(0 + virtual offset), %rsi
; nextln: movq rsp(0 + virtual offset), %rsi
; nextln: addl %edi, %esi
;; Put an effectful instruction so that the live-ranges of the adds and