[llvm] [X86][GlobalIsel] add strictfp attribute from ir in mir (PR #136702)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 22 07:14:56 PDT 2025
https://github.com/mahesh-attarde created https://github.com/llvm/llvm-project/pull/136702
I am supporting `G_IS_FPCLASS` opcode and noticed `strictfp` attribute was not forwarded into MIFlag.
This patch adds attribute to MIR in GISEL-IRTranslator.
Requirement comes from `G_IS_FPCLASS` PR https://github.com/mahesh-attarde/llvm-project/pull/4 for strictfp.
>From 8fc25f7e0d12159c89dfb0cc2eac2df129b68fd7 Mon Sep 17 00:00:00 2001
From: mattarde <mattarde at intel.com>
Date: Tue, 22 Apr 2025 07:09:02 -0700
Subject: [PATCH] [X86][GlobalIsel] add strictfp attribute from ir in mir
---
llvm/lib/CodeGen/MachineInstr.cpp | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/llvm/lib/CodeGen/MachineInstr.cpp b/llvm/lib/CodeGen/MachineInstr.cpp
index 2bc18001081ea..26b31e33bec0c 100644
--- a/llvm/lib/CodeGen/MachineInstr.cpp
+++ b/llvm/lib/CodeGen/MachineInstr.cpp
@@ -630,6 +630,10 @@ uint32_t MachineInstr::copyFlagsFromInstruction(const Instruction &I) {
if (I.getMetadata(LLVMContext::MD_unpredictable))
MIFlags |= MachineInstr::MIFlag::Unpredictable;
+ if (const CallInst *CI = dyn_cast<CallInst>(&I)) {
+ MIFlags |=
+ CI->hasFnAttr(llvm::Attribute::StrictFP) ? MachineInstr::NoFPExcept : 0;
+ }
return MIFlags;
}
More information about the llvm-commits
mailing list