On 11/21/2017 06:14 AM, Dominik Inführ wrote:
Hi,

this patch tries to extend tree-ssa-dce.c to remove unnecessary 
new/delete-pairs (it already does that for malloc/free). Clang does it too and 
it seems to be allowed by 
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3664.html. I’ve 
bootstrapped/regtested on aarch64-linux and x86_64-linux.

nice.

--- a/gcc/tree-core.h
+++ b/gcc/tree-core.h
@@ -1787,7 +1787,9 @@ struct GTY(()) tree_function_decl {
   unsigned has_debug_args_flag : 1;
   unsigned tm_clone_flag : 1;
   unsigned versioned_function : 1;
-  /* No bits left.  */
+
+  unsigned operator_delete_flag : 1;
+  /* 31 bits left.  */
 };

that's unpleasant. We have DECL_IS_{MALLOC,OPERATOR_{NEW,DELETE}} flags, which are all mutually exclusive. If only there was a way to encode a 4-valued enumeration in fewer than 3 bits ... :) (not sure why we don't have DECL_IS_FREE, and as we don't, why is DECL_IS_OPERATOR_DELETE needed?

(we also have DECL_IS_{CON,DE}STRUCTOR flags, which I think are also mutually exclusive with the above. So that's 5 or (6 if we add DECL_IS_FREE), that could be encoded in 3 bits.

There may be even more mutually exclusive flags, DECL_STATIC_{CON,DE}STRUCTOR may be candiates?


nathan

--
Nathan Sidwell

Reply via email to