mirror of
https://github.com/gcc-mirror/gcc.git
synced 2026-05-06 06:49:09 +02:00
phiopt: Set cfgchanged if cselim-limited happened
I noticed while improving cselim-limited that if not creating a new phi, there are a few empty basic blocks. So this sets cfgcleanup when cselim-limited does something in phiopt. cselim-5.c shows the case I was looking into. gcc/ChangeLog: * tree-ssa-phiopt.cc (pass_phiopt::execute): Set cfgcleanup if cselim_limited returns true. gcc/testsuite/ChangeLog: * gcc.dg/tree-ssa/cselim-5.c: New test. Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
This commit is contained in:
16
gcc/testsuite/gcc.dg/tree-ssa/cselim-5.c
Normal file
16
gcc/testsuite/gcc.dg/tree-ssa/cselim-5.c
Normal file
@@ -0,0 +1,16 @@
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-O1 -fdump-tree-phiopt1" } */
|
||||
|
||||
int t;
|
||||
void f(int a, int b, int c, int d)
|
||||
{
|
||||
if (b)
|
||||
t = 0;
|
||||
else
|
||||
t = 0;
|
||||
}
|
||||
|
||||
/* We should sink/merge the stores and end up with a single BB. */
|
||||
|
||||
/* { dg-final { scan-tree-dump-times "t = 0;" 1 "phiopt1" } } */
|
||||
/* { dg-final { scan-tree-dump-times "<bb " 1 "phiopt1" } } */
|
||||
@@ -4048,10 +4048,11 @@ pass_phiopt::execute (function *)
|
||||
hoist_adjacent_loads (bb, bb1, bb2, bb3);
|
||||
|
||||
/* Try to see if there are only store in each side of the if
|
||||
and try to remove that; don't do this for -Og. */
|
||||
and try to remove that; don't do this for -Og.
|
||||
With sinking the stores we might end up with empty blocks. */
|
||||
if (EDGE_COUNT (bb3->preds) == 2 && !optimize_debug)
|
||||
while (cond_if_else_store_replacement_limited (bb1, bb2, bb3))
|
||||
;
|
||||
cfgchanged = true;
|
||||
}
|
||||
|
||||
gimple_stmt_iterator gsi;
|
||||
|
||||
Reference in New Issue
Block a user