-
Notifications
You must be signed in to change notification settings - Fork 14.3k
Simple check to ignore Inline asm fwait insertion #101686
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
Simple check to ignore Inline asm fwait insertion #101686
Conversation
Thank you for submitting a Pull Request (PR) to the LLVM Project! This PR will be automatically labeled and the relevant teams will be If you wish to, you can add reviewers by using the "Reviewers" section on this page. If this is not working for you, it is probably because you do not have write If you have received no comments on your PR for a week, you can request a review If you have further questions, they may be answered by the LLVM GitHub User Guide. You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums. |
@llvm/pr-subscribers-backend-x86 Author: Temperatureblock (Temperature-block) ChangesJust a simple check to ignore Inline asm fwait insertion Full diff: https://github.com/llvm/llvm-project/pull/101686.diff 2 Files Affected:
diff --git a/llvm/lib/Target/X86/X86InsertWait.cpp b/llvm/lib/Target/X86/X86InsertWait.cpp
index 69a3d32a93149..0a1810a3da711 100644
--- a/llvm/lib/Target/X86/X86InsertWait.cpp
+++ b/llvm/lib/Target/X86/X86InsertWait.cpp
@@ -103,8 +103,9 @@ bool WaitInsert::runOnMachineFunction(MachineFunction &MF) {
for (MachineBasicBlock &MBB : MF) {
for (MachineBasicBlock::iterator MI = MBB.begin(); MI != MBB.end(); ++MI) {
- // Jump non X87 instruction.
- if (!X86::isX87Instruction(*MI))
+
+ // Jump non X87 instruction and Inline asm.
+ if (!X86::isX87Instruction(*MI) || MI->isInlineAsm())
continue;
// If the instruction instruction neither has float exception nor is
// a load/store instruction, or the instruction is x87 control
diff --git a/llvm/test/CodeGen/X86/pr59305.ll b/llvm/test/CodeGen/X86/pr59305.ll
index 46c9da5a51939..5185f1429f289 100644
--- a/llvm/test/CodeGen/X86/pr59305.ll
+++ b/llvm/test/CodeGen/X86/pr59305.ll
@@ -81,20 +81,17 @@ define double @bar(double %0) #0 {
; X64-NEXT: #APP
; X64-NEXT: ldmxcsr 0
; X64-NEXT: #NO_APP
-; X64-NEXT: wait
; X64-NEXT: movsd {{.*#+}} xmm2 = [1.0E+0,0.0E+0]
; X64-NEXT: movapd %xmm2, %xmm3
; X64-NEXT: divsd %xmm0, %xmm3
; X64-NEXT: #APP
; X64-NEXT: ldmxcsr 0
; X64-NEXT: #NO_APP
-; X64-NEXT: wait
; X64-NEXT: movapd %xmm2, %xmm1
; X64-NEXT: divsd %xmm0, %xmm1
; X64-NEXT: #APP
; X64-NEXT: ldmxcsr 0
; X64-NEXT: #NO_APP
-; X64-NEXT: wait
; X64-NEXT: divsd %xmm0, %xmm2
; X64-NEXT: movapd %xmm3, %xmm0
; X64-NEXT: callq fma@PLT
|
if (!X86::isX87Instruction(*MI)) | ||
|
||
// Jump non X87 instruction and Inline asm. | ||
if (!X86::isX87Instruction(*MI) || MI->isInlineAsm()) |
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.
Put the check in isX87Instruction
?
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.
Oops my bad I accidentally force pushed incomplete changes, will update today sorry for any confusions.
a3eb806
to
9d43e74
Compare
Pre-checkin failure is relevant, please check it. |
Changes X86InstrInfo.cpp updated with check to ignore inlineasm pr59305.ll Test case fix
9d43e74
to
1324a5f
Compare
@phoebewang |
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.
LGTM.
@Temperature-block Congratulations on having your first Pull Request (PR) merged into the LLVM Project! Your changes will be combined with recent changes from other authors, then tested Please check whether problems have been caused by your change specifically, as How to do this, and the rest of the post-merge process, is covered in detail here. If your change does cause a problem, it may be reverted, or you can revert it yourself. If you don't get any reports, no action is required from you. Your changes are working as expected, well done! |
Just a simple check to ignore Inline asm fwait insertion
Fixes #101613