[llvm] [LLVM][CodeGen] When expanding ISD::LRINT, non-deterministic results should be frozen. (PR #197435)
Paul Walker via llvm-commits
llvm-commits at lists.llvm.org
Wed May 13 06:29:19 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));
----------------
paulwalker-arm wrote:
ISD::FP_TO_SINT is the operation that can generate a poison result.
https://github.com/llvm/llvm-project/pull/197435
More information about the llvm-commits
mailing list