[llvm] r279797 - Fix the static_assert added in r279536.

Akira Hatanaka via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 25 17:22:13 PDT 2016


Author: ahatanak
Date: Thu Aug 25 19:22:12 2016
New Revision: 279797

URL: http://llvm.org/viewvc/llvm-project?rev=279797&view=rev
Log:
Fix the static_assert added in r279536.

The assertion doesn't always hold true as sizeof(SDNodeBits) isn't equal
to sizeof(uint16_t) for some targets. For example, sizeof(SDNodeBits)
evaluates to 1, not 2, for ARM's APCS targets.

Modified:
    llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h

Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h?rev=279797&r1=279796&r2=279797&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h (original)
+++ llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h Thu Aug 25 19:22:12 2016
@@ -1098,8 +1098,8 @@ public:
   unsigned getRawSubclassData() const {
     uint16_t Data;
     memcpy(&Data, &SDNodeBits, sizeof(SDNodeBits));
-    static_assert(sizeof(SDNodeBits) == sizeof(uint16_t),
-                  "SDNodeBits field too small?");
+    static_assert(sizeof(SDNodeBits) <= sizeof(uint16_t),
+                  "SDNodeBits field too large?");
     return Data;
   }
 




More information about the llvm-commits mailing list