[PATCH] D87200: [SelectionDAGBuilder] Pass fast math flags to getNode calls rather than trying to set them after the fact.
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Sep 6 07:46:20 PDT 2020
spatel added reviewers: jsji, nemanjai, steven.zhang, aemerson, hfinkel, qiucf.
spatel added a comment.
I drafted a similar patch, and I think removing the saved-state complexity is worth it.
The other possibility -- and this patch doesn't have to be gated on this, but it could save a lot of back-and-forth -- is to set up a FastMathFlagGuard object like we have in IRBuilder (adding reviewers from D87037 <https://reviews.llvm.org/D87037>).
================
Comment at: llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:4875-4877
// TODO: What fast-math-flags should be set here?
SDValue t0 = DAG.getNode(ISD::FMUL, dl, MVT::f32, Op,
DAG.getConstantFP(numbers::log2ef, dl, MVT::f32));
----------------
Should use the incoming Flags now.
================
Comment at: llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:4889
+ const TargetLowering &TLI, SDNodeFlags Flags) {
// TODO: What fast-math-flags should be set on the floating-point nodes?
----------------
Should use the incoming Flags on all created nodes now.
================
Comment at: llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:5010
// error 0.0049451742, which is more than 7 bits
SDValue t0 = DAG.getNode(ISD::FMUL, dl, MVT::f32, X,
getF32Constant(DAG, 0xbeb08fe0, dl));
----------------
Should use the incoming Flags on all created nodes now.
================
Comment at: llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:5085
+ const TargetLowering &TLI, SDNodeFlags Flags) {
// TODO: What fast-math-flags should be set on the floating-point nodes?
----------------
Should use the incoming Flags on all created nodes now.
================
Comment at: llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:5197
// TODO: What fast-math-flags should be set on the FMUL node?
if (IsExp10) {
----------------
Should use the incoming Flags on all created nodes now.
================
Comment at: llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:8956
+ if (auto *FPMO = dyn_cast<FPMathOperator>(&I)) {
+ FMF = FPMO->getFastMathFlags();
+ SDFlags.copyFMF(*FPMO);
----------------
Could get rid of the FMF temp and use SDFlags everywhere below.
================
Comment at: llvm/test/CodeGen/PowerPC/fmf-propagation.ll:560
; FMFDEBUG: ch,glue = callseq_end t15, TargetConstant:i64<32>, TargetConstant:i64<0>, t15:1
-; FMFDEBUG: f64,ch,glue = CopyFromReg afn t16, Register:f64 $f1, t16:1
+; FMFDEBUG: f64,ch,glue = CopyFromReg t16, Register:f64 $f1, t16:1
; FMFDEBUG: Type-legalized selection DAG: %bb.0 'log2_approx:'
----------------
We need to find where this flag got dropped?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D87200/new/
https://reviews.llvm.org/D87200
More information about the llvm-commits
mailing list