From cf9d549f2c40d548587f8d2d3cda0d32f13c9256 Mon Sep 17 00:00:00 2001
From: Temperatureblock <102174059+Temperature-block@users.noreply.github.com>
Date: Mon, 12 Aug 2024 20:06:58 +0530
Subject: [PATCH] Simple check to ignore Inline asm fwait insertion (#101686)

Just a simple check to ignore Inline asm fwait insertion

Fixes #101613
---
 llvm/lib/Target/X86/X86InstrInfo.cpp | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/llvm/lib/Target/X86/X86InstrInfo.cpp b/llvm/lib/Target/X86/X86InstrInfo.cpp
index 10a0ccdcb023..e615fa09608c 100644
--- a/llvm/lib/Target/X86/X86InstrInfo.cpp
+++ b/llvm/lib/Target/X86/X86InstrInfo.cpp
@@ -2947,6 +2947,11 @@ static bool isX87Reg(unsigned Reg) {
 
 /// check if the instruction is X87 instruction
 bool X86::isX87Instruction(MachineInstr &MI) {
+  // Call and inlineasm defs X87 register, so we special case it here because
+  // otherwise calls are incorrectly flagged as x87 instructions
+  // as a result.
+  if (MI.isInlineAsm())
+    return false;
   for (const MachineOperand &MO : MI.operands()) {
     if (!MO.isReg())
       continue;
-- 
Gitee
