Richard Guenther - Re: [patch] for PR 26900 (original) (raw)
This is the mail archive of the gcc-patches@gcc.gnu.orgmailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
- From: Richard Guenther
- To: Zdenek Dvorak
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Fri, 16 Feb 2007 21:49:04 +0100 (CET)
- Subject: Re: [patch] for PR 26900
- References: <20070210200651.GA6389@atrey.karlin.mff.cuni.cz> <Pine.LNX.4.64.0702161342510.18923@zhemvz.fhfr.qr> <20070216134610.GA3820@atrey.karlin.mff.cuni.cz> <Pine.LNX.4.64.0702161452400.18923@zhemvz.fhfr.qr> <20070216150229.GA21368@atrey.karlin.mff.cuni.cz> <Pine.LNX.4.64.0702161609350.18923@zhemvz.fhfr.qr> <Pine.LNX.4.64.0702161805490.18923@zhemvz.fhfr.qr> <20070216175852.GA17299@atrey.karlin.mff.cuni.cz>
On Fri, 16 Feb 2007, Zdenek Dvorak wrote:
Hello,
Btw, I bootstrapped and tested the following patch on top of yours on x86_64-unknown-linux-gnu.
do you have some testcase where this is useful? I guess it can avoid need to use invert_truthvalue in some cases.
I just restructured the code moving the invert_truthvalue case last and adding additional allowed return values (folding a && b to a or !a || b to !a allows us to derive a value for b, too, not only true and false folding results).
No, I didn't search for a testcase.
Richard.
Zdenek
Richard.
Index: tree-ssa-loop-niter.c
*** tree-ssa-loop-niter.c (revision 122036) --- tree-ssa-loop-niter.c (working copy) *************** tree_simplify_using_condition_1 (tree co *** 832,852 ****
te = expand_simple_operations (expr);
! /* Check whether COND ==> EXPR. / notcond = invert_truthvalue (cond); e = fold_binary (TRUTH_OR_EXPR, boolean_type_node, notcond, te); if (e && integer_nonzerop (e)) return e; ! ! / Check whether COND ==> not EXPR. */ ! e = fold_binary (TRUTH_AND_EXPR, boolean_type_node, cond, te); ! if (e && integer_zerop (e)) ! return e;
return expr;
}
! /* Tries to simplify EXPR using the condition COND. Returns the simplified expression (or EXPR unchanged, if no simplification was possible). Wrapper around tree_simplify_using_condition_1 that ensures that chains of simple operations in definitions of ssa names in COND are expanded, --- 833,860 ----
te = expand_simple_operations (expr);
! e = fold_binary (TRUTH_AND_EXPR, boolean_type_node, cond, te); ! /* If COND && EXPR is false, EXPR is false. / ! if (e && integer_zerop (e)) ! return e; ! / If COND && EXPR is equal to COND or true, EXPR is true. */ ! if (e && (e == cond || integer_nonzerop (e))) ! return boolean_true_node; ! notcond = invert_truthvalue (cond); e = fold_binary (TRUTH_OR_EXPR, boolean_type_node, notcond, te);
/* If !COND || EXPR is true then EXPR is true. / if (e && integer_nonzerop (e)) return e; ! / If !COND || EXPR is equal to !COND or false then EXPR is false. */ ! if (e && (e == notcond || integer_zerop (e))) ! return boolean_false_node;
return expr;
}
! /* Tries to simplify EXPR using the condition COND which is known to ! evaluate to true at the point EXPR is evaluated. Returns the simplified expression (or EXPR unchanged, if no simplification was possible). Wrapper around tree_simplify_using_condition_1 that ensures that chains of simple operations in definitions of ssa names in COND are expanded,
-- Richard Guenther rguenther@suse.de Novell / SUSE Labs SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746 - GF: Markus Rex
- References:
- [patch] for PR 26900
* From: Zdenek Dvorak - Re: [patch] for PR 26900
* From: Richard Guenther - Re: [patch] for PR 26900
* From: Zdenek Dvorak - Re: [patch] for PR 26900
* From: Richard Guenther - Re: [patch] for PR 26900
* From: Zdenek Dvorak - Re: [patch] for PR 26900
* From: Richard Guenther - Re: [patch] for PR 26900
* From: Richard Guenther - Re: [patch] for PR 26900
* From: Zdenek Dvorak
- [patch] for PR 26900
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |