* Fix for PR44932
@ 2010-07-18 6:38 Xinliang David Li
2010-07-18 18:22 ` Richard Guenther
0 siblings, 1 reply; 3+ messages in thread
From: Xinliang David Li @ 2010-07-18 6:38 UTC (permalink / raw)
To: GCC Patches
[-- Attachment #1: Type: text/plain, Size: 312 bytes --]
Hi, this patch fixes the problem reported in 44932. The bogus warning
is emitted because the predicate set for the definitions are not
properly computed as a result of the bug in collecting the edge set
for phi operands that are defined.
Bootstrapped and tested on x86-64/linux.
Ok to checkin?
Thanks,
David
[-- Attachment #2: uninit_44932.p --]
[-- Type: application/octet-stream, Size: 4051 bytes --]
Index: gcc/tree-ssa-uninit.c
===================================================================
--- gcc/tree-ssa-uninit.c (revision 162159)
+++ gcc/tree-ssa-uninit.c (working copy)
@@ -490,17 +490,33 @@ collect_phi_def_edges (gimple phi, basic
opnd_edge = gimple_phi_arg_edge (phi, i);
opnd = gimple_phi_arg_def (phi, i);
- if (TREE_CODE (opnd) != SSA_NAME
- || !ssa_undefined_value_p (opnd))
- VEC_safe_push (edge, heap, *edges, opnd_edge);
+ if (TREE_CODE (opnd) != SSA_NAME)
+ {
+ if (dump_file)
+ {
+ fprintf (dump_file, "\n[CHECK] Found def edge %d in ", (int)i);
+ print_gimple_stmt (dump_file, phi, 0, 0);
+ }
+ VEC_safe_push (edge, heap, *edges, opnd_edge);
+ }
else
{
gimple def = SSA_NAME_DEF_STMT (opnd);
+
if (gimple_code (def) == GIMPLE_PHI
&& dominated_by_p (CDI_DOMINATORS,
gimple_bb (def), cd_root))
collect_phi_def_edges (def, cd_root, edges,
visited_phis);
+ else if (!ssa_undefined_value_p (opnd))
+ {
+ if (dump_file)
+ {
+ fprintf (dump_file, "\n[CHECK] Found def edge %d in ", (int)i);
+ print_gimple_stmt (dump_file, phi, 0, 0);
+ }
+ VEC_safe_push (edge, heap, *edges, opnd_edge);
+ }
}
}
}
@@ -1530,7 +1546,7 @@ is_use_properly_guarded (gimple use_stmt
if (dump_file)
dump_predicates (use_stmt, num_preds, preds,
- "Use in stmt ");
+ "\nUse in stmt ");
has_valid_preds = find_def_preds (&def_preds,
&num_def_preds, phi);
@@ -1615,15 +1631,26 @@ find_uninit_use (gimple phi, unsigned un
}
pointer_set_destroy (visited_phis);
+ if (dump_file)
+ {
+ fprintf (dump_file, "[CHECK]: Found unguarded use: ");
+ print_gimple_stmt (dump_file, use_stmt, 0, 0);
+ }
/* Found one real use, return. */
if (gimple_code (use_stmt) != GIMPLE_PHI)
- return use_stmt;
+ return use_stmt;
/* Found a phi use that is not guarded,
add the phi to the worklist. */
if (!pointer_set_insert (added_to_worklist,
use_stmt))
{
+ if (dump_file)
+ {
+ fprintf (dump_file, "[WORKLIST]: Update worklist with phi: ");
+ print_gimple_stmt (dump_file, use_stmt, 0, 0);
+ }
+
VEC_safe_push (gimple, heap, *worklist, use_stmt);
pointer_set_insert (possibly_undefined_names,
phi_result);
@@ -1658,6 +1685,12 @@ warn_uninitialized_phi (gimple phi, VEC(
if (MASK_EMPTY (uninit_opnds))
return;
+ if (dump_file)
+ {
+ fprintf (dump_file, "[CHECK]: examining phi: ");
+ print_gimple_stmt (dump_file, phi, 0, 0);
+ }
+
/* Now check if we have any use of the value without proper guard. */
uninit_use_stmt = find_uninit_use (phi, uninit_opnds,
worklist, added_to_worklist);
@@ -1717,6 +1750,11 @@ execute_late_warn_uninitialized (void)
{
VEC_safe_push (gimple, heap, worklist, phi);
pointer_set_insert (added_to_worklist, phi);
+ if (dump_file)
+ {
+ fprintf (dump_file, "[WORKLIST]: add to initial list: ");
+ print_gimple_stmt (dump_file, phi, 0, 0);
+ }
break;
}
}
@@ -1728,7 +1766,7 @@ execute_late_warn_uninitialized (void)
cur_phi = VEC_pop (gimple, worklist);
warn_uninitialized_phi (cur_phi, &worklist, added_to_worklist);
}
-
+
VEC_free (gimple, heap, worklist);
pointer_set_destroy (added_to_worklist);
pointer_set_destroy (possibly_undefined_names);
[-- Attachment #3: cl --]
[-- Type: application/octet-stream, Size: 291 bytes --]
2010-07-16 Xinliang David Li <davidxl@google.com>
PR testsuite/44932
* tree-ssa-uninit.c (collect_phi_def_edges): Fix bug collecting def edges.
(find_uninit_use): Add dump.
(is_use_properly_guarded): Ditto.
(warn_uninitialized_phi): Ditto.
(execute_late_warn_uninitialized): Ditto.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Fix for PR44932
2010-07-18 6:38 Fix for PR44932 Xinliang David Li
@ 2010-07-18 18:22 ` Richard Guenther
2010-07-19 16:35 ` Xinliang David Li
0 siblings, 1 reply; 3+ messages in thread
From: Richard Guenther @ 2010-07-18 18:22 UTC (permalink / raw)
To: Xinliang David Li; +Cc: GCC Patches
On Sun, Jul 18, 2010 at 8:38 AM, Xinliang David Li <davidxl@google.com> wrote:
> Hi, this patch fixes the problem reported in 44932. The bogus warning
> is emitted because the predicate set for the definitions are not
> properly computed as a result of the bug in collecting the edge set
> for phi operands that are defined.
>
> Bootstrapped and tested on x86-64/linux.
>
> Ok to checkin?
Ok if you guard the extra dump_file printing by && (dump_flags & TDF_DETAILS).
Thanks,
Richard.
> Thanks,
>
> David
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Fix for PR44932
2010-07-18 18:22 ` Richard Guenther
@ 2010-07-19 16:35 ` Xinliang David Li
0 siblings, 0 replies; 3+ messages in thread
From: Xinliang David Li @ 2010-07-19 16:35 UTC (permalink / raw)
To: Richard Guenther; +Cc: GCC Patches
Made the suggested change and submitted it.
Thanks,
David
On Sun, Jul 18, 2010 at 11:22 AM, Richard Guenther
<richard.guenther@gmail.com> wrote:
> On Sun, Jul 18, 2010 at 8:38 AM, Xinliang David Li <davidxl@google.com> wrote:
>> Hi, this patch fixes the problem reported in 44932. The bogus warning
>> is emitted because the predicate set for the definitions are not
>> properly computed as a result of the bug in collecting the edge set
>> for phi operands that are defined.
>>
>> Bootstrapped and tested on x86-64/linux.
>>
>> Ok to checkin?
>
> Ok if you guard the extra dump_file printing by && (dump_flags & TDF_DETAILS).
>
> Thanks,
> Richard.
>
>> Thanks,
>>
>> David
>>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-07-19 16:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-18 6:38 Fix for PR44932 Xinliang David Li
2010-07-18 18:22 ` Richard Guenther
2010-07-19 16:35 ` Xinliang David Li
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).