Mark inout asm! operands as used in liveness pass
This commit is contained in:
parent
ffeeb20398
commit
cc0b718aaa
2 changed files with 37 additions and 1 deletions
|
@ -1174,7 +1174,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
hir::InlineAsmOperand::InOut { expr, .. } => {
|
hir::InlineAsmOperand::InOut { expr, .. } => {
|
||||||
succ = self.write_place(expr, succ, ACC_READ | ACC_WRITE);
|
succ = self.write_place(expr, succ, ACC_READ | ACC_WRITE | ACC_USE);
|
||||||
}
|
}
|
||||||
hir::InlineAsmOperand::SplitInOut { out_expr, .. } => {
|
hir::InlineAsmOperand::SplitInOut { out_expr, .. } => {
|
||||||
if let Some(expr) = out_expr {
|
if let Some(expr) = out_expr {
|
||||||
|
|
36
src/test/ui/liveness/liveness-issue-77915.rs
Normal file
36
src/test/ui/liveness/liveness-issue-77915.rs
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
// Ensure inout asm! operands are marked as used by the liveness pass
|
||||||
|
|
||||||
|
// only-x86_64
|
||||||
|
// check-pass
|
||||||
|
|
||||||
|
#![feature(asm)]
|
||||||
|
#![allow(dead_code)]
|
||||||
|
#![deny(unused_variables)]
|
||||||
|
|
||||||
|
// Tests the single variable inout case
|
||||||
|
unsafe fn rep_movsb(mut dest: *mut u8, mut src: *const u8, mut n: usize) -> *mut u8 {
|
||||||
|
while n != 0 {
|
||||||
|
asm!(
|
||||||
|
"rep movsb",
|
||||||
|
inout("rcx") n,
|
||||||
|
inout("rsi") src,
|
||||||
|
inout("rdi") dest,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
dest
|
||||||
|
}
|
||||||
|
|
||||||
|
// Tests the split inout case
|
||||||
|
unsafe fn rep_movsb2(mut dest: *mut u8, mut src: *const u8, mut n: usize) -> *mut u8 {
|
||||||
|
while n != 0 {
|
||||||
|
asm!(
|
||||||
|
"rep movsb",
|
||||||
|
inout("rcx") n,
|
||||||
|
inout("rsi") src => src,
|
||||||
|
inout("rdi") dest,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
dest
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {}
|
Loading…
Add table
Add a link
Reference in a new issue