public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Trevor Saunders <tsaunders@mozilla.com>
To: "Martin Liška" <mliska@suse.cz>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH 3/5] IPA ICF pass
Date: Tue, 01 Jul 2014 23:45:00 -0000	[thread overview]
Message-ID: <20140701234501.GA21606@tsaunders-iceball.corp.tor1.mozilla.com> (raw)
In-Reply-To: <53B15254.2040003@suse.cz>

> diff --git a/gcc/ipa-icf.c b/gcc/ipa-icf.c
> new file mode 100644
> index 0000000..8a13dca
> --- /dev/null
> +++ b/gcc/ipa-icf.c
> +/* Itializes internal structures according to given number of

initialize

> +      if (is_a_helper<cgraph_node *>::test (node))

shouldn't you just use is_a<cgraph_node*> (node) ?

> +sem_item_optimizer::filter_removed_items (void)
> +{
> +  vec <sem_item *> filtered;
> +  filtered.create (m_items.length());

use auto_vec here?

> +  m_items.release ();
> +
> +  for (unsigned int i = 0; i < filtered.length(); i++)
> +    m_items.safe_push (filtered[i]);

hrm, maybe adding vec::swap makes sense.

> +	  if (c->members.length() > 1)
> +	    {
> +	      vec <sem_item *> new_vector;
> +	      new_vector.create (c->members.length ());

same comment about auto_vec and swap.

> +bool
> +sem_item_optimizer::release_split_map (__attribute__((__unused__)) congruence_class *
> +				       const &cls,
> +				       __attribute__((__unused__)) bitmap const &b,

that one is definitly used

> +				       __attribute__((__unused__)) traverse_split_pair *pair)

Why can't you just leave the arguments unnamed to fix the warning?

> +sem_item_optimizer::do_congruence_step_for_index (congruence_class *cls,
> +    unsigned int index)
> +{
> +  hash_map <congruence_class *, bitmap> *split_map =
> +  	new hash_map <congruence_class *, bitmap> ();

why aren't you putting the hash_map on  the stack? in any case it looks
like you fail to delete it when your done with it.

> diff --git a/gcc/ipa-icf.h b/gcc/ipa-icf.h
> new file mode 100644
> index 0000000..d328dd6
> --- /dev/null
> +++ b/gcc/ipa-icf.h
> @@ -0,0 +1,743 @@
> +/* Prints string STRING to a FILE with a given number of SPACE_COUNT.  */
> +#define FPUTS_SPACES(file, space_count, string) \
> +  do \
> +  { \
> +    fprintf (file, "%*s" string, space_count, " "); \

seems like you could do this with a static inline function.

> +/* Prints a MESSAGE to dump_file if exists.  */
> +#define SE_DUMP_MESSAGE(message) \
> +  do \
> +  { \
> +    if (dump_file && (dump_flags & TDF_DETAILS)) \
> +      fprintf (dump_file, "  debug message: %s (%s:%u)\n", message, __func__, __LINE__); \

a inline function that used the builtins like the memory statis stuff
might be slightly less ugly imho

> +/* Logs a MESSAGE to dump_file if exists and returns false.  */
> +#define SE_EXIT_FALSE_WITH_MSG(message) \
> +  do \
> +  { \
> +    if (dump_file && (dump_flags & TDF_DETAILS)) \
> +      fprintf (dump_file, "  false returned: '%s' (%s:%u)\n", message, __func__, __LINE__); \
> +    return false; \
> +  } \
> +  while (false);

ugh macros that effect control flow, instead maybe define a inline
function that does the logging and then returns the value you want your
function to return so you can write

if (whatever)
  return SE_LOG (NULL, "something or other");
?

> +/* Forward declaration for sem_func class.  */
> +class sem_item;

comment is wrong, and imho useless.

> +  /* Initializes internal structures according to given number of
> +     source and target SSA names. The number of source names is SSA_SOURCE,
> +     respectively SSA_TARGET.  */
> +  func_checker (unsigned ssa_source, unsigned sss_target);

ssa_target?

> +  /* Source to target edge map.  */
> +  hash_map <edge, edge> *m_edge_map;

is there a reason to not embedd these in the object? you seem to create
them in the ctor and delete them in the dtor, so I expect they have teh
same lifetime.

> +/* Basic block struct for sematic equality pass.  */

semantic?

> +typedef struct sem_bb

you don't need the typedef in C++

> +  /* Item type.  */
> +  enum sem_item_type type;

 loose the enum keyword since you don't need it?

> +class sem_function: public sem_item
> +{
> +  /* COMPARED_FUNC is a function that we compare to.  */
> +  sem_function *m_compared_func;

this feels like a weird place for this, would func_checker maybe make
more sense as a place to put it?

> +class sem_variable: public sem_item
> +{
> +  /* Initializes references to other semantic functions/variables.  */
> +  inline virtual void init_refs ()

iirc defining with in a class definition implies inline.

> +typedef struct congruence_class_group
> +{
> +  hashval_t hash;
> +  sem_item_type type;
> +  vec <congruence_class *> classes;
> +} congruence_class_group_t;

lose the typedef?

> +  /* Returns true if a congruence class CLS is presented in worklist.  */

s/presented/present/ ?

Trev

  reply	other threads:[~2014-07-01 23:45 UTC|newest]

Thread overview: 70+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-16 10:07 [PATCH 1/5] New Identical Code Folding IPA pass mliska
2014-06-16 10:07 ` [PATCH 4/5] Existing tests fix mliska
2014-06-17 19:52   ` Jeff Law
2014-06-17 20:50     ` Rainer Orth
2014-06-18  9:02       ` Martin Liška
2014-06-30 12:12     ` Martin Liška
2014-09-26 12:21       ` Martin Liška
2014-06-16 10:07 ` [PATCH 5/5] New tests introduction mliska
2014-06-17 19:53   ` Jeff Law
2014-06-30 12:14     ` Martin Liška
2014-10-19  8:19       ` Andreas Schwab
2014-10-23 12:34         ` Martin Liška
2014-06-16 10:07 ` [PATCH 2/5] Existing call graph infrastructure enhancement mliska
2014-06-17 20:00   ` Jeff Law
2014-06-30 11:49     ` Martin Liška
2014-06-30 18:54       ` Jeff Law
2014-07-17 14:54         ` Martin Liška
2014-08-25  9:56           ` Martin Liška
2014-08-25 16:12             ` Jan Hubicka
2014-08-27 21:12             ` Jeff Law
2014-09-24 14:23   ` Martin Liška
2014-09-24 15:01     ` Jan Hubicka
2014-09-26 10:19       ` Martin Liška
2014-06-16 10:07 ` [PATCH 3/5] IPA ICF pass mliska
2014-06-20  7:32   ` Trevor Saunders
2014-06-26 11:18     ` Martin Liška
2014-07-05 21:44     ` Gerald Pfeifer
2014-07-05 22:53       ` Jan Hubicka
2014-07-17 15:23         ` Martin Liška
2014-09-26 12:20           ` Martin Liška
2014-09-26 14:44             ` Markus Trippelsdorf
2014-09-26 23:27               ` Jan Hubicka
2014-09-27  5:59                 ` Markus Trippelsdorf
2014-09-27  7:47                   ` Markus Trippelsdorf
2014-09-27 10:46                     ` Martin Liška
2014-09-27 10:37                   ` Martin Liška
2014-09-28  2:21                     ` Jan Hubicka
2014-10-10 23:54                       ` Fakturace
2014-10-11  0:02                       ` Martin Liška
2014-10-11  8:23                         ` Jan Hubicka
2014-10-13 13:20                           ` Martin Liška
2014-10-13 13:29                             ` Jan Hubicka
2014-09-27 10:32                 ` Martin Liška
2014-09-26 20:47             ` Jan Hubicka
2014-10-11  0:08               ` Martin Liška
2014-10-11  8:26                 ` Jan Hubicka
2014-10-13 15:17                 ` Martin Liška
2014-10-14 16:12                   ` Jan Hubicka
2014-10-15 17:06                     ` Martin Liška
2014-10-22 21:20                       ` Jiong Wang
2014-11-06  3:01                         ` Joey Ye
2014-11-06  9:03                           ` Jan Hubicka
2014-11-13 22:26                       ` H.J. Lu
2015-01-20 21:29                         ` H.J. Lu
2014-09-26 22:27             ` Jan Hubicka
2014-10-11  0:23               ` Martin Liška
2014-10-11  9:05                 ` Jan Hubicka
2014-06-24 20:31   ` Jeff Law
2014-06-26 16:02     ` Martin Liška
2014-06-26 18:46     ` Jan Hubicka
2014-06-30 12:05       ` Martin Liška
2014-07-01 23:45         ` Trevor Saunders [this message]
2014-06-30 19:06       ` Jeff Law
2014-06-17 19:49 ` [PATCH 1/5] New Identical Code Folding IPA pass Jeff Law
2014-06-18 19:05   ` Jan Hubicka
2014-06-17 20:09 ` Paolo Carlini
2014-06-18  8:46   ` Martin Liška
2014-06-18  8:49     ` Paolo Carlini
2014-06-17 20:17 ` David Malcolm
2014-06-18  8:10   ` Martin Liška

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140701234501.GA21606@tsaunders-iceball.corp.tor1.mozilla.com \
    --to=tsaunders@mozilla.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=mliska@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).