[PATCH] D28675: [DAGCombine] require UnsafeFPMath for re-association of addition

Nicolai Hähnle via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 19 13:30:24 PST 2017

nhaehnle added a comment.

In https://reviews.llvm.org/D28675#650423, @spatel wrote:

> The patch will cause a crash [...]

Of course *sigh*

Out of the various forms of dealing with this, how about this:

   const SDNodeFlags *SDNode::getFlags() const {
     if (auto *FlagsNode = dyn_cast<BinaryWithFlagsSDNode>(this))
       return &FlagsNode->Flags;
  -  return nullptr;
  +  static const SDNodeFlags DefaultFlags;
  +  return &DefaultFlags;

That keeps callers of getFlags() simple. In terms of run-time performance it also seems reasonable: getFlags() isn't inlined anyway (it lives in SelectionDAG.cpp).


More information about the llvm-commits mailing list