[PATCH] D26942: [SelectionDAG] getRawSubclassData should not return HasDebugValue.

Chih-Hung Hsieh via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 30 16:24:10 PST 2016


chh added a comment.

Chandler,

Stephen and I guessed that the following diff is what you want.

  --- include/llvm/CodeGen/SelectionDAGNodes.h    (revision 287585)
  +++ include/llvm/CodeGen/SelectionDAGNodes.h    (working copy)
  @@ -415,6 +415,7 @@
     class SDNodeBitfields {
       friend class SDNode;
       friend class MemIntrinsicSDNode;
  +    friend class MemSDNode;
  
       uint16_t HasDebugValue : 1;
       uint16_t IsMemIntrinsic : 1;
  @@ -1134,11 +1135,19 @@
       return MMO->getAlignment();
     }
  
  -  /// Return the SubclassData value, which contains an
  +  /// Return the SubclassData value, without HasDebugValue. This contains an
     /// encoding of the volatile flag, as well as bits used by subclasses. This
     /// function should only be used to compute a FoldingSetNodeID value.
  +  /// The HasDebugValue bit is masked out because CSE map needs to match
  +  /// nodes with debug info with nodes without debug info.
     unsigned getRawSubclassData() const {
       uint16_t Data;
  +    union {
  +      char RawSDNodeBits[sizeof(uint16_t)];
  +      SDNodeBitfields SDNodeBits;
  +    };
  +    memcpy(&RawSDNodeBits, &this->RawSDNodeBits, sizeof(this->RawSDNodeBits));
  +    SDNodeBits.HasDebugValue = 0;
       memcpy(&Data, &RawSDNodeBits, sizeof(RawSDNodeBits));
       return Data;
     }

Assuming the memcpy will be optimized as much as possible,
it should generate similar code to my 2nd diff in
https://reviews.llvm.org/D26942?id=78800

Please let us know which version you like or tell us the exact code.
Next Android llvm upgrade is pending on this bug fix.
Thanks.


https://reviews.llvm.org/D26942





More information about the llvm-commits mailing list