Bug 58134 - [4.8/4.9 Regression] -ftree-vectorizer-verbose=<n> shows vectorized loops only for N== 1 and N >2 but not for N==2
Summary: [4.8/4.9 Regression] -ftree-vectorizer-verbose=<n> shows vectorized loops onl...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.9.0
: P3 normal
Target Milestone: 4.8.3
Assignee: Not yet assigned to anyone
URL:
Keywords: diagnostic
Depends on:
Blocks:
 
Reported: 2013-08-12 06:04 UTC by Tobias Burnus
Modified: 2013-10-31 16:11 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Burnus 2013-08-12 06:04:42 UTC
... -ftree-vectorizer-verbose=1 test.cc
test.cc:8: note: Vectorized loop

But no result for
-ftree-vectorizer-verbose=2 test.cc 2>&1|grep 'Vectorized loop'

Again with n >= 3:
-ftree-vectorizer-verbose=3 test.cc 2>&1|grep 'Vectorized loop'
test.cc:8: note: Vectorized loop


#include <algorithm>
typedef int myint;

void max(__restrict myint *data, myint val, int n) {
  //__assume_aligned(data,64);
  data = (myint*) __builtin_assume_aligned(data, 64);
  for (int i = 0; i < n; i++)
    data[i] = std::max(data[i], val);
}
Comment 1 Tobias Burnus 2013-08-12 18:00:38 UTC
The reason is the following:
          dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location,
                           "Vectorized loop\n");

And in opts-global.c's dump_remap_tree_vectorizer_verbose:
  switch (value)
    {
    case 0:
      break;
    case 1:
      remapped_opt_info = "optimized";
      break;
    case 2:
      remapped_opt_info = "missed";
      break;
    default:
      remapped_opt_info = "all";
      break;
    }

And dumpfile.h:
#define MSG_OPTIMIZED_LOCATIONS  (1 << 26)  /* -fopt-info optimized sources */
#define MSG_MISSED_OPTIMIZATION  (1 << 27)  /* missed opportunities */
#define MSG_NOTE                 (1 << 28)  /* general optimization info */
#define MSG_ALL         (MSG_OPTIMIZED_LOCATIONS | MSG_MISSED_OPTIMIZATION \
                         | MSG_NOTE)
Comment 2 Tobias Burnus 2013-08-12 18:05:48 UTC
Using g++-4.7 -O3 -ftree-vectorizer-verbose=2 it works as one gets:
 7: LOOP VECTORIZED.

Seemingly caused by r193061
Comment 3 Sharad Singhai 2013-08-12 19:13:03 UTC
I think this is the intended behavior. While working on the new dump infrastructure, I modified the behavior of -ftree-vectorizer-verbose.

Thus right now
-ftree-vectorizer-verbose=1 : dump info about optimized loops
...=2 : dump info about missed loops
...>2 : dump info about optimized _and_ missed loops

Thus at 3 and greater, you are again seeing info available at 1. But really, only 1 and 2 are meaningful. Anything higher is a combination of these two kinds of information. This was a way to preserve compatibility with old scripts, while deprecating this flag. I didn't see any tests relying on the old behavior.

Here is the current documentation about this flag in gcc.info:

`-ftree-vectorizer-verbose=N'
     This option is deprecated and is implemented in terms of
     `-fopt-info'. Please use `-fopt-info-KIND' form instead, where
     KIND is one of the valid opt-info options. It prints additional
     optimization information.  For N=0 no diagnostic information is
     reported.  If N=1 the vectorizer reports each loop that got
     vectorized, and the total number of loops that got vectorized.  If
     N=2 the vectorizer reports locations which could not be vectorized
     and the reasons for those. For any higher verbosity levels all the
     analysis and transformation information from the vectorizer is
     reported.
Comment 4 Sharad Singhai 2013-08-29 01:05:50 UTC
I think perhaps it would be better if I remove this deprecated option -ftree-vectorizer-verbose= completely. It is confusing in its current form and the equivalent functionality is already available via -fopt-info-xxx option.

Any opinions?

Thanks,
Sharad
Comment 5 Jakub Jelinek 2013-10-16 09:49:29 UTC
GCC 4.8.2 has been released.
Comment 6 Sharad Singhai 2013-10-31 01:01:43 UTC
Author: singhai
Date: Thu Oct 31 01:01:40 2013
New Revision: 204244

URL: http://gcc.gnu.org/viewcvs?rev=204244&root=gcc&view=rev
Log:
2013-10-30  Sharad Singhai  <singhai@google.com>

	PR middle-end/58134
	* opts.c (common_handle_option): Remove deprecated option
	-ftree-vectorizer-verbose.
	* doc/invoke.texi (Debugging Options): Ditto.
	* opts-global.c (handle_common_deferred_options): Ditto.
	(dump_remap_tree_vectorizer_verbose): Delete.
	* common.opt: Set -ftree-vectorizer-verbose as an ignored option.

ada/ChangeLog
	* gnat_ugn.texi: Remove option description for PR middle-end/58134.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/ada/ChangeLog
    trunk/gcc/ada/gnat_ugn.texi
    trunk/gcc/common.opt
    trunk/gcc/doc/invoke.texi
    trunk/gcc/opts-global.c
    trunk/gcc/opts.c
Comment 7 Sharad Singhai 2013-10-31 16:11:02 UTC
I have removed this deprecated option in r204244, hence marking it fixed.