[PATCH] D12095: propagate fast-math-flags on DAG nodes
hfinkel@anl.gov via llvm-commits
llvm-commits at lists.llvm.org
Sun Aug 30 14:18:44 PDT 2015
hfinkel added inline comments.
================
Comment at: lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:4290
@@ +4289,3 @@
+ if (auto *FlagsNode = dyn_cast<BinaryWithFlagsSDNode>(Node))
+ Flags = &FlagsNode->Flags;
+
----------------
spatel wrote:
> hfinkel wrote:
> > This is repeated a lot. Can we add a utility function to SDNode that does this?
> >
> Sure - that would have saved a lot of cut and paste. :)
> I think this would be a virtual function in SDNode that returns a nullptr and derived classes would return a pointer to their SDNodeFlags if they have them. However, I see that SDNode has no virtual functions, so adding one means I should also add a virtual destructor? But is the lack of virtual functions in this class to avoid a vtable for size/perf? If that's a conscious design decision, is it better to fake a virtual function with something like:
> const SDNodeFlags *SDNode::getFlags() const {
> if (auto *FlagsNode = dyn_cast<BinaryWithFlagsSDNode>(this))
> return &FlagsNode->Flags;
> return nullptr;
> }
>
I think that it is a conscious design decision; I'd not induce the creation of a vtable just for this, and your suggestion is what I had in mind (it probably can't be inlined either way).
http://reviews.llvm.org/D12095
More information about the llvm-commits
mailing list