https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71915
Bug ID: 71915 Summary: A missed opportunity for SLSR Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: marxin at gcc dot gnu.org Target Milestone: --- Hello. This is a follow-up of PR71490, where we started to FAIL slsr-8.c test-case. Problem is that starting from r237185, we sink into both branches: Sinking x3_18 = c_13(D) + _9; from bb 2 to bb 3 Sinking _9 = -_8; from bb 2 to bb 3 Sinking _8 = _7 * 4; from bb 2 to bb 3 Sinking _7 = (long unsigned int) a3_17; from bb 2 to bb 3 Sinking a3_17 = s_11(D) * 6; from bb 2 to bb 3 Sinking x2_16 = c_13(D) + _6; from bb 2 to bb 5 Sinking _6 = -_5; from bb 2 to bb 5 Sinking _5 = _4 * 4; from bb 2 to bb 5 Sinking _4 = (long unsigned int) a2_15; from bb 2 to bb 5 Sinking a2_15 = s_11(D) * 4; from bb 2 to bb 5 f (int s, int * c) { int * x3; int * x2; int * x1; int a3; int a2; int a1; long unsigned int _1; long unsigned int _2; sizetype _3; long unsigned int _4; long unsigned int _5; sizetype _6; long unsigned int _7; long unsigned int _8; sizetype _9; int * iftmp.0_10; <bb 2>: a1_12 = s_11(D) * 2; _1 = (long unsigned int) a1_12; _2 = _1 * 4; _3 = -_2; x1_14 = c_13(D) + _3; if (x1_14 != 0B) goto <bb 5>; else goto <bb 3>; <bb 5>: a2_15 = s_11(D) * 4; _4 = (long unsigned int) a2_15; _5 = _4 * 4; _6 = -_5; x2_16 = c_13(D) + _6; goto <bb 4>; <bb 3>: a3_17 = s_11(D) * 6; _7 = (long unsigned int) a3_17; _8 = _7 * 4; _9 = -_8; x3_18 = c_13(D) + _9; <bb 4>: # iftmp.0_10 = PHI <x2_16(5), x3_18(3)> return iftmp.0_10; } While in time when the test-case was introduced, we sank just to one branch: Sinking x3_18 = c_7(D) + _17; from bb 2 to bb 3 Sinking _17 = -_16; from bb 2 to bb 3 Sinking _16 = _15 * 4; from bb 2 to bb 3 Sinking _15 = (long unsigned int) a3_14; from bb 2 to bb 3 Sinking a3_14 = s_2(D) * 6; from bb 2 to bb 3 f (int s, int * c) { int * x3; int * x2; int * x1; int a3; int a2; int a1; int * iftmp.0; long unsigned int _4; long unsigned int _5; sizetype _6; long unsigned int _10; long unsigned int _11; sizetype _12; long unsigned int _15; long unsigned int _16; sizetype _17; <bb 2>: a1_3 = s_2(D) * 2; _4 = (long unsigned int) a1_3; _5 = _4 * 4; _6 = -_5; x1_8 = c_7(D) + _6; a2_9 = s_2(D) * 4; _10 = (long unsigned int) a2_9; _11 = _10 * 4; _12 = -_11; x2_13 = c_7(D) + _12; if (x1_8 != 0B) goto <bb 5>; else goto <bb 3>; <bb 5>: goto <bb 4>; <bb 3>: a3_14 = s_2(D) * 6; _15 = (long unsigned int) a3_14; _16 = _15 * 4; _17 = -_16; x3_18 = c_7(D) + _17; <bb 4>: # iftmp.0_1 = PHI <x2_13(5), x3_18(3)> return iftmp.0_1; } Because of that, slsr does not cover one opportunity. Martin