[llvm] [SelectionDAG] Preserve fast math flags when legalizing/promoting (PR #130124)
John Brawn via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 7 06:46:26 PST 2025
================
@@ -5075,6 +5075,9 @@ void SelectionDAGLegalize::PromoteNode(SDNode *Node) {
if (Node->getOpcode() == ISD::BR_CC ||
Node->getOpcode() == ISD::SELECT_CC)
OVT = Node->getOperand(2).getSimpleValueType();
+ // Preserve fast math flags
+ SDNodeFlags FastMathFlags = Node->getFlags() & SDNodeFlags::FastMathFlags;
+ SelectionDAG::FlagInserter FlagsInserter(DAG, FastMathFlags);
----------------
john-brawn-arm wrote:
I'll clean up the now-redundant setting of flags later in this function in a follow-on patch.
https://github.com/llvm/llvm-project/pull/130124
More information about the llvm-commits
mailing list