[PATCH] D61331: [SelectionDAG] remove constant folding limitations based on FP exceptions

Andy Kaylor via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 30 12:55:35 PDT 2019


andrew.w.kaylor added a comment.

Why wouldn't we want to reuse this code path?

We made the decision that we are initially willing to live with poor optimization in order to get correctness for the constrained FP implementation, but the plan all along has been that after we had correct results we wanted to go back to re-enable optimizations. I'm just trying to avoid making that path harder.

What I'm asking for here is something like this:

  SDValue SelectionDAG::foldConstantFPMath(unsigned Opcode, const SDLoc &DL,
  SDValue SelectionDAG::foldConstantFPMath(unsigned Opcode, const SDLoc &DL,
                                           EVT VT, SDValue N1, SDValue N2) {
    auto *N1CFP = dyn_cast<ConstantFPSDNode>(N1.getNode());
    auto *N2CFP = dyn_cast<ConstantFPSDNode>(N2.getNode());
    bool HasFPExceptions = false;
    APFloat::roundingMode = APFloat::round_to_nearest;
    // FIXME: Add support for strict FP rounding and exception semantics.

That would produce the same effect as this patch. To support it we'd just need extra arguments to provide the rounding mode and exception semantics. I think those are probably even available not far up the stack from where this is called.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61331/new/

https://reviews.llvm.org/D61331





More information about the llvm-commits mailing list