+2018-09-28 David Malcolm <dmalcolm@redhat.com>
+
+ * coverage.c (get_coverage_counts): Convert problem-reporting dump
+ messages from MSG_OPTIMIZED_LOCATIONS to MSG_MISSED_OPTIMIZATION.
+ * dumpfile.c (kind_as_string): New function.
+ (dump_loc): Rather than a hardcoded prefix of "note: ", use
+ kind_as_string to vary the prefix based on dump_kind.
+ (selftest::test_capture_of_dump_calls): Update for above.
+
2018-09-28 Uros Bizjak <ubizjak@gmail.com>
* config/i386/i386.h (SSE_REGNO): Fix check for FIRST_REX_SSE_REG.
{
dump_user_location_t loc
= dump_user_location_t::from_location_t (input_location);
- dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, loc,
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, loc,
"file %s not found, %s\n", da_file_name,
(flag_guess_branch_prob
? "execution counts estimated"
{
dump_user_location_t loc
= dump_user_location_t::from_location_t (input_location);
- dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, loc,
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, loc,
"use -Wno-error=coverage-mismatch to tolerate "
"the mismatch but performance may drop if the "
"function is hot\n");
if (!seen_error ()
&& !warned++)
{
- dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, loc,
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, loc,
"coverage mismatch ignored\n");
- dump_printf (MSG_OPTIMIZED_LOCATIONS,
+ dump_printf (MSG_MISSED_OPTIMIZATION,
flag_guess_branch_prob
? G_("execution counts estimated\n")
: G_("execution counts assumed to be zero\n"));
if (!flag_guess_branch_prob)
- dump_printf (MSG_OPTIMIZED_LOCATIONS,
+ dump_printf (MSG_MISSED_OPTIMIZATION,
"this can result in poorly optimized code\n");
}
}
DECL_SOURCE_LOCATION (fndecl));
}
+/* Extract the MSG_* component from DUMP_KIND and return a string for use
+ as a prefix to dump messages.
+ These match the strings in optinfo_verbosity_options and thus the
+ "OPTIONS" within "-fopt-info-OPTIONS". */
+
+static const char *
+kind_as_string (dump_flags_t dump_kind)
+{
+ switch (dump_kind & MSG_ALL)
+ {
+ default:
+ gcc_unreachable ();
+ case MSG_OPTIMIZED_LOCATIONS:
+ return "optimized";
+ case MSG_MISSED_OPTIMIZATION:
+ return "missed";
+ case MSG_NOTE:
+ return "note";
+ }
+}
+
/* Print source location on DFILE if enabled. */
static void
if (dump_kind)
{
if (LOCATION_LOCUS (loc) > BUILTINS_LOCATION)
- fprintf (dfile, "%s:%d:%d: note: ", LOCATION_FILE (loc),
+ fprintf (dfile, "%s:%d:%d: ", LOCATION_FILE (loc),
LOCATION_LINE (loc), LOCATION_COLUMN (loc));
else if (current_function_decl)
- fprintf (dfile, "%s:%d:%d: note: ",
+ fprintf (dfile, "%s:%d:%d: ",
DECL_SOURCE_FILE (current_function_decl),
DECL_SOURCE_LINE (current_function_decl),
DECL_SOURCE_COLUMN (current_function_decl));
+ fprintf (dfile, "%s: ", kind_as_string (dump_kind));
/* Indentation based on scope depth. */
fprintf (dfile, "%*s", get_dump_scope_depth (), "");
}
if (dump_kind)
{
if (LOCATION_LOCUS (loc) > BUILTINS_LOCATION)
- pp_printf (pp, "%s:%d:%d: note: ", LOCATION_FILE (loc),
+ pp_printf (pp, "%s:%d:%d: ", LOCATION_FILE (loc),
LOCATION_LINE (loc), LOCATION_COLUMN (loc));
else if (current_function_decl)
- pp_printf (pp, "%s:%d:%d: note: ",
+ pp_printf (pp, "%s:%d:%d: ",
DECL_SOURCE_FILE (current_function_decl),
DECL_SOURCE_LINE (current_function_decl),
DECL_SOURCE_COLUMN (current_function_decl));
+ pp_printf (pp, "%s: ", kind_as_string (dump_kind));
/* Indentation based on scope depth. */
for (unsigned i = 0; i < get_dump_scope_depth (); i++)
pp_character (pp, ' ');
}
dump_printf_loc (MSG_NOTE, stmt, "msg 7\n");
- ASSERT_DUMPED_TEXT_EQ (tmp, "test.txt:5:10: note: msg 4\n");
+ ASSERT_DUMPED_TEXT_EQ (tmp, "test.txt:5:10: optimized: msg 4\n");
}
}
+2018-09-28 David Malcolm <dmalcolm@redhat.com>
+
+ * c-c++-common/unroll-1.c: Update expected output from "note" to
+ "optimized".
+ * c-c++-common/unroll-2.c: Likewise.
+ * c-c++-common/unroll-3.c: Likewise.
+ * g++.dg/tree-ssa/dom-invalid.C: Update expected output from
+ dg-message to dg-missed. Convert param from -fopt-info to
+ -fopt-info-missed-ipa.
+ * g++.dg/tree-ssa/pr81408.C: Update expected output from
+ dg-message to dg-missed.
+ * g++.dg/vect/slp-pr56812.cc: Update expected output from
+ dg-message to dg-optimized.
+ * gcc.dg/pr26570.c: Update expected output from dg-message to
+ dg-missed. Convert param from -fopt-info to
+ -fopt-info-missed-ipa.
+ * gcc.dg/pr32773.c: Likewise.
+ * gcc.dg/tree-ssa/pr19210-1.c: Update expected output from
+ dg-message to dg-missed.
+ * gcc.dg/unroll-2.c: Update expected output from dg-message to
+ dg-optimized.
+ * gcc.dg/vect/nodump-vect-opt-info-1.c: Likewise. Convert param
+ from -fopt-info to -fopt-info-vec.
+ * gfortran.dg/directive_unroll_1.f90: Update expected output from
+ "note" to "optimized".
+ * gfortran.dg/directive_unroll_2.f90: Likewise.
+ * gfortran.dg/directive_unroll_3.f90: Likewise.
+ * gnat.dg/unroll4.adb: Likewise.
+ * lib/gcc-dg.exp (dg-optimized): New procedure.
+ (dg-missed): New procedure.
+
2018-09-28 Joseph Myers <joseph@codesourcery.com>
PR c/87390
#pragma GCC unroll 8
for (unsigned long i = 1; i <= 15; ++i)
bar(i);
- /* { dg-final { scan-rtl-dump "21:.*: note: loop unrolled 7 times" "loop2_unroll" } } */
+ /* { dg-final { scan-rtl-dump "21:.*: optimized: loop unrolled 7 times" "loop2_unroll" } } */
#pragma GCC unroll 8
for (unsigned long i = 1; i <= j; ++i)
bar(i);
- /* { dg-final { scan-rtl-dump "26:.*: note: loop unrolled 7 times" "loop2_unroll" } } */
+ /* { dg-final { scan-rtl-dump "26:.*: optimized: loop unrolled 7 times" "loop2_unroll" } } */
#pragma GCC unroll 7
for (unsigned long i = 1; i <= j; ++i)
bar(i);
- /* { dg-final { scan-rtl-dump "31:.*: note: loop unrolled 3 times" "loop2_unroll" } } */
+ /* { dg-final { scan-rtl-dump "31:.*: optimized: loop unrolled 3 times" "loop2_unroll" } } */
unsigned long i = 0;
#pragma GCC unroll 3
do {
bar(i);
} while (++i < 9);
- /* { dg-final { scan-rtl-dump "3\[79\]:.*: note: loop unrolled 2 times" "loop2_unroll" } } */
+ /* { dg-final { scan-rtl-dump "3\[79\]:.*: optimized: loop unrolled 2 times" "loop2_unroll" } } */
}
#pragma GCC unroll 8
for (unsigned long i = 1; i <= 15; ++i)
bar(i);
- /* { dg-final { scan-rtl-dump "21:.*: note: loop unrolled 7 times" "loop2_unroll" } } */
+ /* { dg-final { scan-rtl-dump "21:.*: optimized: loop unrolled 7 times" "loop2_unroll" } } */
#pragma GCC unroll 8
for (unsigned long i = 1; i <= j; ++i)
bar(i);
- /* { dg-final { scan-rtl-dump "26:.*: note: loop unrolled 7 times" "loop2_unroll" } } */
+ /* { dg-final { scan-rtl-dump "26:.*: optimized: loop unrolled 7 times" "loop2_unroll" } } */
#pragma GCC unroll 7
for (unsigned long i = 1; i <= j; ++i)
bar(i);
- /* { dg-final { scan-rtl-dump "31:.*: note: loop unrolled 3 times" "loop2_unroll" } } */
+ /* { dg-final { scan-rtl-dump "31:.*: optimized: loop unrolled 3 times" "loop2_unroll" } } */
unsigned long i = 0;
#pragma GCC unroll 3
do {
bar(i);
} while (++i < 9);
- /* { dg-final { scan-rtl-dump "3\[79\]:.*: note: loop unrolled 2 times" "loop2_unroll" } } */
+ /* { dg-final { scan-rtl-dump "3\[79\]:.*: optimized: loop unrolled 2 times" "loop2_unroll" } } */
}
#pragma GCC unroll 8
for (unsigned long i = 1; i <= 8; ++i)
bar(i);
- /* { dg-final { scan-rtl-dump-not "11:.*: note: loop unrolled" "loop2_unroll" } } */
+ /* { dg-final { scan-rtl-dump-not "11:.*: optimized: loop unrolled" "loop2_unroll" } } */
#pragma GCC unroll 8
for (unsigned long i = 1; i <= 7; ++i)
bar(i);
- /* { dg-final { scan-rtl-dump-not "16:.*: note: loop unrolled" "loop2_unroll" } } */
+ /* { dg-final { scan-rtl-dump-not "16:.*: optimized: loop unrolled" "loop2_unroll" } } */
#pragma GCC unroll 8
for (unsigned long i = 1; i <= 15; ++i)
bar(i);
- /* { dg-final { scan-rtl-dump "21:.*: note: loop unrolled 7 times" "loop2_unroll" } } */
+ /* { dg-final { scan-rtl-dump "21:.*: optimized: loop unrolled 7 times" "loop2_unroll" } } */
#pragma GCC unroll 8
for (unsigned long i = 1; i <= j; ++i)
bar(i);
- /* { dg-final { scan-rtl-dump "26:.*: note: loop unrolled 7 times" "loop2_unroll" } } */
+ /* { dg-final { scan-rtl-dump "26:.*: optimized: loop unrolled 7 times" "loop2_unroll" } } */
#pragma GCC unroll 7
for (unsigned long i = 1; i <= j; ++i)
bar(i);
- /* { dg-final { scan-rtl-dump "31:.*: note: loop unrolled 3 times" "loop2_unroll" } } */
+ /* { dg-final { scan-rtl-dump "31:.*: optimized: loop unrolled 3 times" "loop2_unroll" } } */
unsigned long i = 0;
#pragma GCC unroll 3
do {
bar(i);
} while (++i < 9);
- /* { dg-final { scan-rtl-dump "3\[79\]:.*: note: loop unrolled 2 times" "loop2_unroll" } } */
+ /* { dg-final { scan-rtl-dump "3\[79\]:.*: optimized: loop unrolled 2 times" "loop2_unroll" } } */
}
// PR tree-optimization/39557
// invalid post-dom info leads to infinite loop
// { dg-do run }
-// { dg-options "-Wall -fno-exceptions -O2 -fprofile-use -fopt-info -fno-rtti -Wno-missing-profile" }
+// { dg-options "-Wall -fno-exceptions -O2 -fprofile-use -fopt-info-missed-ipa -fno-rtti -Wno-missing-profile" }
struct C
{
{
E e;
e.bar ();
-} // { dg-message "note: file" }
+} // { dg-missed "file .* not found" }
void
ShowHelpListCommands ()
{
- for (auto c : t) /* { dg-message "note: missed loop optimization: niters analysis .*" } */
+ for (auto c : t) /* { dg-missed "missed loop optimization: niters analysis .*" } */
a::ax << c.ay << a::av;
}
void mydata::Set (float x)
{
/* We want to vectorize this either as loop or basic-block. */
- for (int i=0; i<upper(); i++) /* { dg-message "note: \[^\n\]* vectorized" } */
+ for (int i=0; i<upper(); i++) /* { dg-optimized "\[^\n\]* vectorized" } */
data[i] = x;
}
/* { dg-do compile } */
-/* { dg-options "-O2 -fprofile-generate -fprofile-use -fopt-info -Wno-missing-profile" } */
+/* { dg-options "-O2 -fprofile-generate -fprofile-use -fopt-info-missed-ipa -Wno-missing-profile" } */
/* { dg-require-profiling "-fprofile-generate" } */
unsigned test (unsigned a, unsigned b)
{
return a / b;
-} /* { dg-message "note: \[^\n\]*execution counts estimated" } */
+} /* { dg-missed "\[^\n\]*execution counts estimated" } */
/* { dg-do compile } */
-/* { dg-options "-O -fprofile-use -fopt-info -Wno-missing-profile" } */
-/* { dg-options "-O -m4 -fprofile-use -fopt-info -Wno-missing-profile" { target sh-*-* } } */
+/* { dg-options "-O -fprofile-use -fopt-info-missed-ipa -Wno-missing-profile" } */
+/* { dg-options "-O -m4 -fprofile-use -fopt-info-missed-ipa -Wno-missing-profile" { target sh-*-* } } */
void foo (int *p)
{
if (p)
*p = 0;
-} /* { dg-message "note: \[^\n\]*execution counts estimated" } */
+} /* { dg-missed "\[^\n\]*execution counts estimated" } */
f (unsigned n)
{
unsigned k;
- for(k = 0;k <= n;k++) /* { dg-message "note: missed loop optimization: niters analysis .*" } */
+ for(k = 0;k <= n;k++) /* { dg-missed "missed loop optimization: niters analysis .*" } */
g();
- for(k = 0;k <= n;k += 4) /* { dg-message "note: missed loop optimization: niters analysis .*" } */
+ for(k = 0;k <= n;k += 4) /* { dg-missed "missed loop optimization: niters analysis .*" } */
g();
/* We used to get warning for this loop. However, since then # of iterations
g();
/* So we need the following loop, instead. */
- for(k = 4;k <= n;k += 5) /* { dg-message "note: missed loop optimization: niters analysis .*" } */
+ for(k = 4;k <= n;k += 5) /* { dg-missed "missed loop optimization: niters analysis .*" } */
g();
- for(k = 15;k >= n;k--) /* { dg-message "note: missed loop optimization: niters analysis .*" } */
+ for(k = 15;k >= n;k--) /* { dg-missed "missed loop optimization: niters analysis .*" } */
g();
}
{
int i;
bar();
- for (i = 0; i < 2; i++) /* { dg-message "note: loop with 2 iterations completely unrolled" } */
+ for (i = 0; i < 2; i++) /* { dg-optimized "loop with 2 iterations completely unrolled" } */
{
a[i]= b[i] + 1;
}
int foo2(void)
{
int i;
- for (i = 0; i < 2; i++) /* { dg-message "note: loop with 2 iterations completely unrolled" } */
+ for (i = 0; i < 2; i++) /* { dg-optimized "loop with 2 iterations completely unrolled" } */
{
a[i]= b[i] + 1;
}
/* { dg-do compile { target vect_int } } */
-/* { dg-additional-options "-std=c99 -fopt-info -O3" } */
+/* { dg-additional-options "-std=c99 -fopt-info-vec -O3" } */
void
vadd (int *dst, int *op1, int *op2, int count)
{
-/* { dg-message "loop vectorized" "" { target *-*-* } .+2 } */
-/* { dg-message "loop versioned for vectorization because of possible aliasing" "" { target *-*-* } .+1 } */
+/* { dg-optimized "loop vectorized" "" { target *-*-* } .+2 } */
+/* { dg-optimized "loop versioned for vectorization because of possible aliasing" "" { target *-*-* } .+1 } */
for (int i = 0; i < count; ++i)
dst[i] = op1[i] + op2[i];
}
DO i=1, n, 1
call dummy(a(i))
ENDDO
-! { dg-final { scan-rtl-dump "24:.: note: loop unrolled 7 times" "loop2_unroll" } }
+! { dg-final { scan-rtl-dump "24:.: optimized: loop unrolled 7 times" "loop2_unroll" } }
end subroutine test2
subroutine test3(a, n)
DO i=n, 1, -1
call dummy(a(i))
ENDDO
-! { dg-final { scan-rtl-dump "36:.: note: loop unrolled 7 times" "loop2_unroll" } }
+! { dg-final { scan-rtl-dump "36:.: optimized: loop unrolled 7 times" "loop2_unroll" } }
end subroutine test3
subroutine test4(a, n)
DO i=1, n, 2
call dummy(a(i))
ENDDO
-! { dg-final { scan-rtl-dump "48:.: note: loop unrolled 7 times" "loop2_unroll" } }
+! { dg-final { scan-rtl-dump "48:.: optimized: loop unrolled 7 times" "loop2_unroll" } }
end subroutine test4
DO i=1, n, 1
call dummy(a(i))
ENDDO
-! { dg-final { scan-rtl-dump "24:.: note: loop unrolled 7 times" "loop2_unroll" } }
+! { dg-final { scan-rtl-dump "24:.: optimized: loop unrolled 7 times" "loop2_unroll" } }
end subroutine test2
subroutine test3(a, n)
DO i=n, 1, -1
call dummy(a(i))
ENDDO
-! { dg-final { scan-rtl-dump "36:.: note: loop unrolled 7 times" "loop2_unroll" } }
+! { dg-final { scan-rtl-dump "36:.: optimized: loop unrolled 7 times" "loop2_unroll" } }
end subroutine test3
subroutine test4(a, n)
DO i=1, n, 2
call dummy(a(i))
ENDDO
-! { dg-final { scan-rtl-dump "48:.: note: loop unrolled 7 times" "loop2_unroll" } }
+! { dg-final { scan-rtl-dump "48:.: optimized: loop unrolled 7 times" "loop2_unroll" } }
end subroutine test4
DO i=1, 8, 1
call dummy(a(i))
ENDDO
-! { dg-final { scan-rtl-dump-not "12:.: note: loop unrolled" "loop2_unroll" } }
+! { dg-final { scan-rtl-dump-not "12:.: optimized: loop unrolled" "loop2_unroll" } }
end subroutine test1
subroutine test2(a, n)
DO i=1, n, 1
call dummy(a(i))
ENDDO
-! { dg-final { scan-rtl-dump "24:.: note: loop unrolled 7 times" "loop2_unroll" } }
+! { dg-final { scan-rtl-dump "24:.: optimized: loop unrolled 7 times" "loop2_unroll" } }
end subroutine test2
subroutine test3(a, n)
DO i=n, 1, -1
call dummy(a(i))
ENDDO
-! { dg-final { scan-rtl-dump "36:.: note: loop unrolled 7 times" "loop2_unroll" } }
+! { dg-final { scan-rtl-dump "36:.: optimized: loop unrolled 7 times" "loop2_unroll" } }
end subroutine test3
subroutine test4(a, n)
DO i=1, n, 2
call dummy(a(i))
ENDDO
-! { dg-final { scan-rtl-dump "48:.: note: loop unrolled 7 times" "loop2_unroll" } }
+! { dg-final { scan-rtl-dump "48:.: optimized: loop unrolled 7 times" "loop2_unroll" } }
end subroutine test4
end Unroll4;
--- { dg-final { scan-rtl-dump-times "note: loop unrolled 7 times" 2 "loop2_unroll" } }
+-- { dg-final { scan-rtl-dump-times "optimized: loop unrolled 7 times" 2 "loop2_unroll" } }
verbose "process-message:\n${dg-messages}" 2
}
+# Handle output from -fopt-info for MSG_OPTIMIZED_LOCATIONS:
+# a successful optimization.
+
+proc dg-optimized { args } {
+ # Make this variable available here and to the saved proc.
+ upvar dg-messages dg-messages
+
+ process-message saved-dg-error "optimized: " "$args"
+}
+
+# Handle output from -fopt-info for MSG_MISSED_OPTIMIZATION:
+# a missed optimization.
+
+proc dg-missed { args } {
+ # Make this variable available here and to the saved proc.
+ upvar dg-messages dg-messages
+
+ process-message saved-dg-error "missed: " "$args"
+}
+
# Check the existence of a gdb in the path, and return true if there
# is one.
#