[SelectionDAG] Fix two issues with SDNode::getRawSubclassData().
authorJustin Lebar <jlebar@google.com>
Fri, 9 Sep 2016 16:07:06 +0000 (16:07 +0000)
committerJustin Lebar <jlebar@google.com>
Fri, 9 Sep 2016 16:07:06 +0000 (16:07 +0000)
commit8b1460250e896b186527b6a9a7c27148387de837
tree96dc0716c750912547247b96ae568be76aa6fabc
parent1eeb11bfd40e7478d09628ff9ddb561a620fbf8e
[SelectionDAG] Fix two issues with SDNode::getRawSubclassData().

1) On some platforms, sizeof(SDNodeBits) == 1, so we were only copying
one byte out of the bitfield when we wanted to copy two, and we were
leaving half of the return value of getRawSubclassData() undefined.

2) Something something bitfields, not sure exactly what the issue or fix
is, yet.  (TODO)

Summary:
Previously we were assuming that SDNodeBits covered all of SDNode's
anonymous subclass data bitfield union.  But that's not right; it might
have size 1, in which it clearly doesn't.

This patch adds a field that does cover the whole union and adds
static_asserts to ensure it stays correct.

Reviewers: ahatanak, chandlerc

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D24223

llvm-svn: 281051
llvm/include/llvm/CodeGen/SelectionDAGNodes.h