Skip to content

Commit 2cc7c09

Browse files
committed
Propagate fast-math flags through fpext
1 parent f5e2c5d commit 2cc7c09

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3976,7 +3976,10 @@ void SelectionDAGBuilder::visitFPExt(const User &I) {
39763976
SDValue N = getValue(I.getOperand(0));
39773977
EVT DestVT = DAG.getTargetLoweringInfo().getValueType(DAG.getDataLayout(),
39783978
I.getType());
3979-
setValue(&I, DAG.getNode(ISD::FP_EXTEND, getCurSDLoc(), DestVT, N));
3979+
SDNodeFlags Flags;
3980+
if (auto *TruncInst = dyn_cast<FPMathOperator>(&I))
3981+
Flags.copyFMF(*TruncInst);
3982+
setValue(&I, DAG.getNode(ISD::FP_EXTEND, getCurSDLoc(), DestVT, N, Flags));
39803983
}
39813984

39823985
void SelectionDAGBuilder::visitFPToUI(const User &I) {

0 commit comments

Comments
 (0)