[Bug tree-optimization/81184] [8 regression] gcc.dg/pr21643.c and gcc.dg/tree-ssa/phi-opt-11.c fail starting with r249450
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81184 --- Comment #11 from seurer at gcc dot gnu.org --- I dug through my logs and the last failures I saw for phi-opt-11.c and pr21643.c on powerpc64 were in mid January immediately before Eric's patch.
[Bug tree-optimization/81184] [8 regression] gcc.dg/pr21643.c and gcc.dg/tree-ssa/phi-opt-11.c fail starting with r249450
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81184 --- Comment #10 from Andreas Krebbel --- I've verified that the problem is fixed on Power. So I've opened a separate BZ for this #85368
[Bug tree-optimization/81184] [8 regression] gcc.dg/pr21643.c and gcc.dg/tree-ssa/phi-opt-11.c fail starting with r249450
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81184 Andreas Krebbel changed: What|Removed |Added CC||krebbel at gcc dot gnu.org --- Comment #9 from Andreas Krebbel --- Is this really fixed for Power64. At least on s390 I still these testcases failing. I had a look into phi-opt-11.c. No IF statements remain although LOGICAL_OP_NON_SHORT_CIRCUIT is not defined on S/390 and hence defaults to true when using -mbranch-cost=2. The testcase appears to expect 2 IFs to remain for function h. However, these get removed phiopt1. This code turns the TRUTH_ANDIF_EXPR condition into a TRUTH_AND_EXPR: fold-const.c:8178 if (LOGICAL_OP_NON_SHORT_CIRCUIT && !flag_sanitize_coverage && (code == TRUTH_AND_EXPR || code == TRUTH_ANDIF_EXPR || code == TRUTH_OR_EXPR || code == TRUTH_ORIF_EXPR)) { enum tree_code ncode, icode; ncode = (code == TRUTH_ANDIF_EXPR || code == TRUTH_AND_EXPR) ? TRUTH_AND_EXPR : TRUTH_OR_EXPR; icode = ncode == TRUTH_AND_EXPR ? TRUTH_ANDIF_EXPR : TRUTH_ORIF_EXPR; ... /* Transform (A AND-IF B) into (A AND B), or (A OR-IF B) into (A OR B). For sequence point consistancy, we need to check for trapping, and side-effects. */ else if (code == icode && simple_operand_p_2 (arg0) && simple_operand_p_2 (arg1)) return fold_build2_loc (loc, ncode, type, arg0, arg1); This prevents the gimplifier from splitting the condition into two separate IF statements. Instead the truth value gets computed: 004t.gimple h (int a, int b, int c, int d) { int D.2246; _1 = a == d; _2 = b > c; _3 = _1 & _2; if (_3 != 0) goto ; else goto ; : D.2246 = d; // predicted unlikely by early return (on trees) predictor. return D.2246; : D.2246 = a; return D.2246; } which eventually gets optimized in phiop1 to: Removing basic block 3 ;; basic block 3, loop depth 0 ;; pred: 2 ;; succ: 4 COND_EXPR in block 2 and PHI in block 4 converted to straightline code. Merging blocks 2 and 4 fix_loop_structure: fixing up loops for function h (int a, int b, int c, int d) { _Bool _1; _Bool _2; _Bool _3; [local count: 1073741825]: _1 = a_5(D) == d_6(D); _2 = b_7(D) > c_8(D); _3 = _1 & _2; return a_5(D); } No IFs.
[Bug tree-optimization/81184] [8 regression] gcc.dg/pr21643.c and gcc.dg/tree-ssa/phi-opt-11.c fail starting with r249450
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81184 Eric Botcazou changed: What|Removed |Added Status|NEW |RESOLVED CC||ebotcazou at gcc dot gnu.org Resolution|--- |FIXED --- Comment #8 from Eric Botcazou --- .
[Bug tree-optimization/81184] [8 regression] gcc.dg/pr21643.c and gcc.dg/tree-ssa/phi-opt-11.c fail starting with r249450
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81184 --- Comment #7 from Eric Botcazou --- Author: ebotcazou Date: Wed Jan 17 11:03:00 2018 New Revision: 256780 URL: https://gcc.gnu.org/viewcvs?rev=256780&root=gcc&view=rev Log: PR tree-optimization/81184 * gcc.dg/pr21643.c: Adjust dg-final line for logical_op_short_circuit targets. * gcc.dg/tree-ssa/phi-opt-11.c: Likewise. Modified: trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/gcc.dg/pr21643.c trunk/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-11.c
[Bug tree-optimization/81184] [8 regression] gcc.dg/pr21643.c and gcc.dg/tree-ssa/phi-opt-11.c fail starting with r249450
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81184 --- Comment #6 from Christophe Lyon --- Note that I posted a related patch some time ago: https://gcc.gnu.org/ml/gcc-patches/2017-10/msg01477.html
[Bug tree-optimization/81184] [8 regression] gcc.dg/pr21643.c and gcc.dg/tree-ssa/phi-opt-11.c fail starting with r249450
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81184 Richard Biener changed: What|Removed |Added Priority|P3 |P1
[Bug tree-optimization/81184] [8 regression] gcc.dg/pr21643.c and gcc.dg/tree-ssa/phi-opt-11.c fail starting with r249450
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81184 --- Comment #5 from Jakub Jelinek --- Most likely the test need better guards on -mbranch-cost= and/or logical_op_short_circuit.
[Bug tree-optimization/81184] [8 regression] gcc.dg/pr21643.c and gcc.dg/tree-ssa/phi-opt-11.c fail starting with r249450
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81184 --- Comment #4 from Martin Liška --- Jakub?
[Bug tree-optimization/81184] [8 regression] gcc.dg/pr21643.c and gcc.dg/tree-ssa/phi-opt-11.c fail starting with r249450
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81184 Christophe Lyon changed: What|Removed |Added Target|powerpc64*-*-* |powerpc64*-*-* arm CC||clyon at gcc dot gnu.org --- Comment #3 from Christophe Lyon --- On arm the regression appeared between 249444 and 249453.
[Bug tree-optimization/81184] [8 regression] gcc.dg/pr21643.c and gcc.dg/tree-ssa/phi-opt-11.c fail starting with r249450
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81184 Thomas Preud'homme changed: What|Removed |Added Last reconfirmed|2017-06-23 00:00:00 |2017-7-13 CC||thopre01 at gcc dot gnu.org --- Comment #2 from Thomas Preud'homme --- These testcases (gcc.dg/pr21643.c and gcc.dg/tree-ssa/phi-opt-11.c) also started to fail for ARM Cortex-M0, Cortex-M3 and Cortex-M4 arm-none-eabi targets.
[Bug tree-optimization/81184] [8 regression] gcc.dg/pr21643.c and gcc.dg/tree-ssa/phi-opt-11.c fail starting with r249450
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81184 Richard Biener changed: What|Removed |Added Target Milestone|--- |8.0
[Bug tree-optimization/81184] [8 regression] gcc.dg/pr21643.c and gcc.dg/tree-ssa/phi-opt-11.c fail starting with r249450
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81184 Martin Liška changed: What|Removed |Added Status|UNCONFIRMED |NEW Last reconfirmed||2017-06-23 CC||jakub at gcc dot gnu.org Assignee|unassigned at gcc dot gnu.org |marxin at gcc dot gnu.org Ever confirmed|0 |1 --- Comment #1 from Martin Liška --- Confirmed, I'm adding Jakub as author of original test-case. The affected function changed from: Optimizing range tests c_2(D) -[0, 31] and -[32, 32] into c_2(D) > 32 Removing basic block 3 ;; basic block 3, loop depth 0 ;; pred: ;; succ: 4 fix_loop_structure: fixing up loops for function f6 (unsigned char c) { int _1; _Bool _5; [100.00%] [count: INV]: if (c_2(D) == 34) goto ; [18.79%] [count: INV] else goto ; [81.21%] [count: INV] [65.95%] [count: INV]: _5 = c_2(D) <= 32; if (_5 != 0) goto ; [31.00%] [count: INV] else goto ; [69.00%] [count: INV] [45.51%] [count: INV]: [100.00%] [count: INV]: # _1 = PHI <2(2), 0(4), 2(3)> return _1; } to: Optimizing range tests c_2(D) -[32, 32] and -[34, 34] into (c_2(D) & 253) != 32 Width = 1 was chosen for reassociation Merging blocks 2 and 3 fix_loop_structure: fixing up loops for function f6 (unsigned char c) { int _1; _Bool _4; unsigned char _5; [100.00%] [count: INV]: _5 = c_2(D) & 253; _4 = _5 == 32; if (_4 != 0) goto ; [10.65%] [count: INV] else goto ; [89.35%] [count: INV] [79.83%] [count: INV]: if (c_2(D) <= 31) goto ; [18.79%] [count: INV] else goto ; [81.21%] [count: INV] [15.00%] [count: INV]: [100.00%] [count: INV]: # _1 = PHI <0(3), 2(2), 2(4)> return _1; } On x86_64 it's different because the function looks as follows: f6 (unsigned char c) { int _1; _Bool _4; _Bool _5; _Bool _7; _Bool _8; _Bool _9; [100.00%] [count: INV]: _5 = c_2(D) == 32; _4 = c_2(D) == 34; _9 = c_2(D) <= 32; _7 = c_2(D) <= 31; _8 = _9 | _4; if (_8 != 0) goto ; [15.00%] [count: INV] else goto ; [85.00%] [count: INV] [15.00%] [count: INV]: [100.00%] [count: INV]: # _1 = PHI <0(2), 2(3)> return _1; } Note that the PR exposes problem where we are able to do predictions for conditions, but here we transform: if (c_2(D) == 34) goto ; [10.65%] [count: INV] else goto ; [89.35%] [count: INV] into: _4 = c_2(D) == 34; and then we do _8 = _9 | _4; if (_8 != 0) It's related to PR79489.