[llvm] [LLVM][CodeGen] When expanding ISD::LRINT, non-deterministic results should be frozen. (PR #197435)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Wed May 13 06:25:09 PDT 2026
================
@@ -4636,9 +4636,11 @@ bool SelectionDAGLegalize::ExpandNode(SDNode *Node) {
SDValue Arg = Node->getOperand(0);
EVT ArgVT = Arg.getValueType();
EVT ResVT = Node->getValueType(0);
- SDLoc dl(Node);
- SDValue RoundNode = DAG.getNode(ISD::FRINT, dl, ArgVT, Arg);
- Results.push_back(DAG.getNode(ISD::FP_TO_SINT, dl, ResVT, RoundNode));
+ SDLoc DL(Node);
+ SDValue RoundNode = DAG.getNode(ISD::FRINT, DL, ArgVT, Arg);
+ SDValue ConvertNode = DAG.getNode(ISD::FP_TO_SINT, DL, ResVT, RoundNode);
+ // Non-deterministic results are equivalent to freeze poison.
+ Results.push_back(DAG.getFreeze(ConvertNode));
----------------
arsenm wrote:
Shouldn't this freeze the FRINT directly? Usually freeze is pushed as far up as possible
https://github.com/llvm/llvm-project/pull/197435
More information about the llvm-commits
mailing list