diff options
author | Martin Liska <mliska@suse.cz> | 2020-08-28 10:26:13 +0200 |
---|---|---|
committer | Martin Liska <mliska@suse.cz> | 2020-12-01 11:43:25 +0100 |
commit | 03eb09292ef228d1d12b5168cdd748583b1f992a (patch) | |
tree | 8e41919c16c723251463ac59666965cbd82e0f6e /gcc/tree-ssa-reassoc.c | |
parent | 58f71a34c68711c4432b45086bfcccb78be7ace5 (diff) | |
download | gcc-03eb09292ef228d1d12b5168cdd748583b1f992a.zip gcc-03eb09292ef228d1d12b5168cdd748583b1f992a.tar.gz gcc-03eb09292ef228d1d12b5168cdd748583b1f992a.tar.bz2 |
Add if-chain to switch conversion pass.
gcc/ChangeLog:
PR tree-optimization/14799
PR ipa/88702
* Makefile.in: Add gimple-if-to-switch.o.
* dbgcnt.def (DEBUG_COUNTER): Add new debug counter.
* passes.def: Include new pass_if_to_switch pass.
* timevar.def (TV_TREE_IF_TO_SWITCH): New timevar.
* tree-pass.h (make_pass_if_to_switch): New.
* tree-ssa-reassoc.c (struct operand_entry): Move to the header.
(dump_range_entry): Move to header file.
(debug_range_entry): Likewise.
(no_side_effect_bb): Make it global.
* tree-switch-conversion.h (simple_cluster::simple_cluster):
Add inline for couple of functions in order to prevent error
about multiple defined symbols.
* gimple-if-to-switch.cc: New file.
* tree-ssa-reassoc.h: New file.
gcc/testsuite/ChangeLog:
PR tree-optimization/14799
PR ipa/88702
* gcc.dg/tree-ssa/pr96480.c: Disable if-to-switch conversion.
* gcc.dg/tree-ssa/reassoc-32.c: Likewise.
* g++.dg/tree-ssa/if-to-switch-1.C: New test.
* gcc.dg/tree-ssa/if-to-switch-1.c: New test.
* gcc.dg/tree-ssa/if-to-switch-2.c: New test.
* gcc.dg/tree-ssa/if-to-switch-3.c: New test.
* gcc.dg/tree-ssa/if-to-switch-4.c: New test.
* gcc.dg/tree-ssa/if-to-switch-5.c: New test.
* gcc.dg/tree-ssa/if-to-switch-6.c: New test.
* gcc.dg/tree-ssa/if-to-switch-7.c: New test.
* gcc.dg/tree-ssa/if-to-switch-8.c: New test.
Diffstat (limited to 'gcc/tree-ssa-reassoc.c')
-rw-r--r-- | gcc/tree-ssa-reassoc.c | 27 |
1 files changed, 4 insertions, 23 deletions
diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c index 89adafa..e594230 100644 --- a/gcc/tree-ssa-reassoc.c +++ b/gcc/tree-ssa-reassoc.c @@ -51,6 +51,7 @@ along with GCC; see the file COPYING3. If not see #include "builtins.h" #include "gimplify.h" #include "case-cfn-macros.h" +#include "tree-ssa-reassoc.h" /* This is a simple global reassociation pass. It is, in part, based on the LLVM pass of the same name (They do some things more/less @@ -188,15 +189,6 @@ static struct int pows_created; } reassociate_stats; -/* Operator, rank pair. */ -struct operand_entry -{ - unsigned int rank; - unsigned int id; - tree op; - unsigned int count; - gimple *stmt_to_insert; -}; static object_allocator<operand_entry> operand_entry_pool ("operand entry pool"); @@ -226,7 +218,7 @@ static bool reassoc_stmt_dominates_stmt_p (gimple *, gimple *); /* Wrapper around gsi_remove, which adjusts gimple_uid of debug stmts possibly added by gsi_remove. */ -bool +static bool reassoc_remove_stmt (gimple_stmt_iterator *gsi) { gimple *stmt = gsi_stmt (*gsi); @@ -2408,18 +2400,7 @@ optimize_ops_list (enum tree_code opcode, For more information see comments above fold_test_range in fold-const.c, this implementation is for GIMPLE. */ -struct range_entry -{ - tree exp; - tree low; - tree high; - bool in_p; - bool strict_overflow_p; - unsigned int idx, next; -}; -void dump_range_entry (FILE *file, struct range_entry *r); -void debug_range_entry (struct range_entry *r); /* Dump the range entry R to FILE, skipping its expression if SKIP_EXP. */ @@ -2449,7 +2430,7 @@ debug_range_entry (struct range_entry *r) an SSA_NAME and STMT argument is ignored, otherwise STMT argument should be a GIMPLE_COND. */ -static void +void init_range_entry (struct range_entry *r, tree exp, gimple *stmt) { int in_p; @@ -4286,7 +4267,7 @@ suitable_cond_bb (basic_block bb, basic_block test_bb, basic_block *other_bb, range test optimization, all SSA_NAMEs set in the bb are consumed in the bb and there are no PHIs. */ -static bool +bool no_side_effect_bb (basic_block bb) { gimple_stmt_iterator gsi; |