On 12/21/2016 03:11 PM, Jakub Jelinek wrote:
On Wed, Dec 21, 2016 at 02:47:49PM -0700, Jeff Law wrote:
It looks like you could avoid a lot of work in pass_post_ipa_warn::execute
by checking if warnings were asked for outside the main loop.  Presumably
you wrote this with the check inside the loop with the expectation that
other warnings might move into this routine, right?

I had it in mind for the -Walloc-zero warning, yes.
And the gate checks whether the warnings are requested:
+  virtual bool gate (function *) { return warn_nonnull != 0; }
If we add further warnings to this pass, they would be added to the main
loop and gate.
Ah, missed that in the gate.



Also in pass_post_ipa_warn::execute, the BITMAP_FREE call is technically in
a correct position, but it might be more maintainable long term if the
allocation/deallocation occur at the same nesting level.

The only case where it makes a difference is where the bitmap is NULL and
there is nothing to free (and that is the common case).
Yes, I know. It's more a style issue -- having the allocation/deallocation at the same scoping level is simply easier for humans to process and thus makes it much less likely for someone to muck it up later (particularly if that routine grows).

Jeff

Reply via email to