* problem with iv-opts and valid gimple
@ 2004-12-10 20:48 Andrew Pinski
2004-12-10 20:52 ` Andrew Pinski
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Pinski @ 2004-12-10 20:48 UTC (permalink / raw)
To: GCC ML; +Cc: Zdenek Dvorak
Even though I cannot find a testcase on the mainline, I could reproduce
the problem with my tree combiner.
find_interesting_uses_cond does not handle TRUTH_NOT_EXPR.
Could you look into how to fix this problem?
This might be able to reproducible on the mainline but I cannot
find a testcase right now.
Thanks,
Andrew Pinski
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: problem with iv-opts and valid gimple
2004-12-10 20:48 problem with iv-opts and valid gimple Andrew Pinski
@ 2004-12-10 20:52 ` Andrew Pinski
2004-12-10 21:12 ` Zdenek Dvorak
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Pinski @ 2004-12-10 20:52 UTC (permalink / raw)
To: Andrew Pinski; +Cc: Zdenek Dvorak, GCC ML
On Dec 10, 2004, at 3:48 PM, Andrew Pinski wrote:
> Even though I cannot find a testcase on the mainline, I could reproduce
> the problem with my tree combiner.
>
> find_interesting_uses_cond does not handle TRUTH_NOT_EXPR.
>
> Could you look into how to fix this problem?
> This might be able to reproducible on the mainline but I cannot
> find a testcase right now.
I had forgot to mention the COND_EXPR looks like:
if (!a) goto b; else goto c;
Thanks,
Andrew Pinski
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: problem with iv-opts and valid gimple
2004-12-10 20:52 ` Andrew Pinski
@ 2004-12-10 21:12 ` Zdenek Dvorak
0 siblings, 0 replies; 3+ messages in thread
From: Zdenek Dvorak @ 2004-12-10 21:12 UTC (permalink / raw)
To: Andrew Pinski; +Cc: GCC ML
Hello,
>
> On Dec 10, 2004, at 3:48 PM, Andrew Pinski wrote:
>
> >Even though I cannot find a testcase on the mainline, I could reproduce
> >the problem with my tree combiner.
> >
> >find_interesting_uses_cond does not handle TRUTH_NOT_EXPR.
> >
> >Could you look into how to fix this problem?
> >This might be able to reproducible on the mainline but I cannot
> >find a testcase right now.
making it kinda hard to test :-). Given that find_interesting_uses_cond
would ICE with TRUTH_NOT_EXPR, it probably cannot be reproduced easily.
Try the patch below.
Zdenek
Index: tree-ssa-loop-ivopts.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-loop-ivopts.c,v
retrieving revision 2.35
diff -c -3 -p -r2.35 tree-ssa-loop-ivopts.c
*** tree-ssa-loop-ivopts.c 7 Dec 2004 21:23:04 -0000 2.35
--- tree-ssa-loop-ivopts.c 10 Dec 2004 21:09:41 -0000
*************** find_interesting_uses_cond (struct ivopt
*** 1206,1211 ****
--- 1206,1216 ----
op0_p = cond_p;
op1_p = &zero;
}
+ else if (TREE_CODE (*cond_p) == TRUTH_NOT_EXPR)
+ {
+ op0_p = &TREE_OPERAND (*cond_p, 0);
+ op1_p = &zero;
+ }
else
{
op0_p = &TREE_OPERAND (*cond_p, 0);
*************** determine_use_iv_cost_condition (struct
*** 3255,3260 ****
--- 3313,3320 ----
rid of it. */
if (TREE_CODE (*use->op_p) == SSA_NAME)
record_invariant (data, *use->op_p, true);
+ else if (TREE_CODE (*use->op_p) == TRUTH_NOT_EXPR)
+ record_invariant (data, TREE_OPERAND (*use->op_p, 0), true);
else
{
record_invariant (data, TREE_OPERAND (*use->op_p, 0), true);
*************** rewrite_use_compare (struct ivopts_data
*** 4544,4553 ****
comp = unshare_expr (get_computation (data->current_loop, use, cand));
cond = *use->op_p;
! op_p = &TREE_OPERAND (cond, 0);
! if (TREE_CODE (*op_p) != SSA_NAME
! || zero_p (get_iv (data, *op_p)->step))
! op_p = &TREE_OPERAND (cond, 1);
op = force_gimple_operand (comp, &stmts, true, SSA_NAME_VAR (*op_p));
if (stmts)
--- 4625,4639 ----
comp = unshare_expr (get_computation (data->current_loop, use, cand));
cond = *use->op_p;
! if (TREE_CODE (cond) == SSA_NAME)
! op_p = use->op_p;
! else
! {
! op_p = &TREE_OPERAND (cond, 0);
! if (TREE_CODE (*op_p) != SSA_NAME
! || zero_p (get_iv (data, *op_p)->step))
! op_p = &TREE_OPERAND (cond, 1);
! }
op = force_gimple_operand (comp, &stmts, true, SSA_NAME_VAR (*op_p));
if (stmts)
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2004-12-10 21:12 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-10 20:48 problem with iv-opts and valid gimple Andrew Pinski
2004-12-10 20:52 ` Andrew Pinski
2004-12-10 21:12 ` Zdenek Dvorak
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).