summaryrefslogtreecommitdiff
path: root/gcc/gimple.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2009-11-19 15:45:48 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2009-11-19 15:45:48 +0000
commitabd3c4756d6834ee72393b3a9d3343aad8d7236f (patch)
treef59f907b10075665e5352400491b62f572508abe /gcc/gimple.c
parent8189766950a1fe0ce81d80fd63a73fce5d85d68c (diff)
downloadgcc-abd3c4756d6834ee72393b3a9d3343aad8d7236f.tar.gz
2009-11-19 Richard Guenther <rguenther@suse.de>
* gimple.c (canonicalize_cond_expr_cond): Strip conversions around truth-valued expressions. * tree.c (free_lang_data): Untangle check for LTO frontend. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@154332 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gimple.c')
-rw-r--r--gcc/gimple.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/gcc/gimple.c b/gcc/gimple.c
index 676e3fd4678..9cec865a728 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -2937,9 +2937,14 @@ recalculate_side_effects (tree t)
tree
canonicalize_cond_expr_cond (tree t)
{
+ /* Strip conversions around boolean operations. */
+ if (CONVERT_EXPR_P (t)
+ && truth_value_p (TREE_CODE (TREE_OPERAND (t, 0))))
+ t = TREE_OPERAND (t, 0);
+
/* For (bool)x use x != 0. */
- if (TREE_CODE (t) == NOP_EXPR
- && TREE_TYPE (t) == boolean_type_node)
+ if (CONVERT_EXPR_P (t)
+ && TREE_CODE (TREE_TYPE (t)) == BOOLEAN_TYPE)
{
tree top0 = TREE_OPERAND (t, 0);
t = build2 (NE_EXPR, TREE_TYPE (t),