[llvm] [IR] Remove the possibility of ConstantExpr having fast-math flags. (PR #94507)

Joshua Cranmer via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 5 10:30:19 PDT 2024


https://github.com/jcranmer-intel created https://github.com/llvm/llvm-project/pull/94507

This possibility was added in https://reviews.llvm.org/D34303 to resolve some assertion failures with cases where FP math operations got constant-folded in constant expressions. With the change of https://github.com/llvm/llvm-project/pull/93038, however, there are no longer any constant expressions capable of being FP math operators, and thus FPMathOperator can go back to being Instruction-only.

>From 03fa03715f6553ab6409338ccc034f4e191b39b2 Mon Sep 17 00:00:00 2001
From: Joshua Cranmer <joshua.cranmer at intel.com>
Date: Wed, 5 Jun 2024 10:21:49 -0700
Subject: [PATCH] [IR] Remove the possibility of ConstantExpr having fast-math
 flags.

This possibility was added in https://reviews.llvm.org/D34303 to resolve
some assertion failures with cases where FP math operations got
constant-folded in constant expressions. With the change of
https://github.com/llvm/llvm-project/pull/93038, however, there are no
longer any constant expressions capable of being FP math operators, and
thus FPMathOperator can go back to being Instruction-only.
---
 llvm/include/llvm/IR/Operator.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/llvm/include/llvm/IR/Operator.h b/llvm/include/llvm/IR/Operator.h
index fda26891acfa7..f63f54ef94107 100644
--- a/llvm/include/llvm/IR/Operator.h
+++ b/llvm/include/llvm/IR/Operator.h
@@ -330,8 +330,6 @@ class FPMathOperator : public Operator {
     unsigned Opcode;
     if (auto *I = dyn_cast<Instruction>(V))
       Opcode = I->getOpcode();
-    else if (auto *CE = dyn_cast<ConstantExpr>(V))
-      Opcode = CE->getOpcode();
     else
       return false;
 



More information about the llvm-commits mailing list