-
Notifications
You must be signed in to change notification settings - Fork 13.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mark inout asm! operands as used in liveness pass #77976
Changes from 2 commits
cc0b718
fd193f2
17c6c59
8f0bced
2720b2d
dc29c7a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Ensure inout asm! operands are marked as used by the liveness pass | ||
|
||
// only-x86_64 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This test could also be made architecture independent by doing something like this:
It would allow testing this by people who use something else than x86_64 as a host. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed in the latest changes, thanks! |
||
// 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 { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you also add a test that ensures projections work correctly as well? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added a couple of test cases for field projection, thanks! |
||
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() {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't dig too deep into this, but looking at
Assign
code as an example, I suspect this may need bothpropagate_through_place_components
andpropagate_through_expr
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like it was determined that
propagate_through_place_components
would be the necessary call here in order to avoid improperly setting the inout expr as its own successor/predecessory.