mir: Store immediates used for indirect arguments in an alloca.

This commit is contained in:
Eduard Burtescu 2016-03-10 21:30:52 +02:00
parent 473f804491
commit 460e66457a

View file

@ -410,7 +410,7 @@ impl<'bcx, 'tcx> MirContext<'bcx, 'tcx> {
// Force by-ref if we have to load through a cast pointer.
let (mut llval, by_ref) = match val {
Immediate(llval) if arg.cast.is_some() => {
Immediate(llval) if arg.is_indirect() || arg.cast.is_some() => {
let llscratch = build::AllocaFcx(bcx.fcx(), arg.original_ty, "arg");
bcx.store(llval, llscratch);
(llscratch, true)