[clang] [CIR] Add Pure trait to IsFPClassOp (PR #186625)

Henrich Lauko via cfe-commits cfe-commits at lists.llvm.org
Sat Mar 14 14:46:14 PDT 2026


https://github.com/xlauko created https://github.com/llvm/llvm-project/pull/186625

IsFPClassOp is a pure classification check on a floating-point value
with no memory effects. Mark it Pure to enable DCE and other
optimizations.

>From bdc92d3d1326dbe3586f2ef8e0f09c9e5edf3e24 Mon Sep 17 00:00:00 2001
From: xlauko <xlauko at mail.muni.cz>
Date: Sat, 14 Mar 2026 22:42:04 +0100
Subject: [PATCH] [CIR] Add Pure trait to IsFPClassOp

IsFPClassOp is a pure classification check on a floating-point value
with no memory effects. Mark it Pure to enable DCE and other
optimizations.
---
 clang/include/clang/CIR/Dialect/IR/CIROps.td | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/include/clang/CIR/Dialect/IR/CIROps.td b/clang/include/clang/CIR/Dialect/IR/CIROps.td
index d9c4356ba95b9..9b04d4aa4773f 100644
--- a/clang/include/clang/CIR/Dialect/IR/CIROps.td
+++ b/clang/include/clang/CIR/Dialect/IR/CIROps.td
@@ -5624,7 +5624,7 @@ def FPClassTestEnum : CIR_I32EnumAttr<"FPClassTest", "floating-point class test
   let cppNamespace = "::cir";
 }
 
-def CIR_IsFPClassOp : CIR_Op<"is_fp_class"> {
+def CIR_IsFPClassOp : CIR_Op<"is_fp_class", [Pure]> {
   let summary = "Corresponding to the `__builtin_fpclassify` builtin function in clang";
 
   let description = [{



More information about the cfe-commits mailing list