From: Richard Biener Date: Fri, 20 Apr 2018 10:31:23 +0000 (+0000) Subject: re PR tree-optimization/85475 (Compile time hog w/ -O1 -fpeel-loops) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b46ebc6c45d7a74ec18a0644f8b4e3c66ea84fb8;p=gcc.git re PR tree-optimization/85475 (Compile time hog w/ -O1 -fpeel-loops) 2018-04-20 Richard Biener PR middle-end/85475 * match.pd ((X * CST) * Y -> (X * Y) * CST): Avoid exponential complexity by forcing a single use of the multiply operand. * gcc.dg/torture/pr85475.c: New testcase. From-SVN: r259519 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e06c6bc76cd..6309170f0b9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-04-20 Richard Biener + + PR middle-end/85475 + * match.pd ((X * CST) * Y -> (X * Y) * CST): Avoid exponential + complexity by forcing a single use of the multiply operand. + 2018-04-20 Martin Jambor ipa/85449 diff --git a/gcc/match.pd b/gcc/match.pd index 442aad15e2c..0de4432d925 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -2578,8 +2578,9 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) /* Reassociate (X * CST) * Y to (X * Y) * CST. This does not introduce signed overflow for CST != 0 && CST != -1. */ (simplify - (mult:c (mult:s @0 INTEGER_CST@1) @2) + (mult:c (mult:s@3 @0 INTEGER_CST@1) @2) (if (TREE_CODE (@2) != INTEGER_CST + && single_use (@3) && !integer_zerop (@1) && !integer_minus_onep (@1)) (mult (mult @0 @2) @1))) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4e66877a9b1..dc5f7e766a5 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-04-20 Richard Biener + + PR middle-end/85475 + * gcc.dg/torture/pr85475.c: New testcase. + 2018-04-20 Martin Jambor ipa/85449 diff --git a/gcc/testsuite/gcc.dg/torture/pr85475.c b/gcc/testsuite/gcc.dg/torture/pr85475.c new file mode 100644 index 00000000000..0d475df3bc6 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr85475.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-fpeel-loops" } */ + +int +nj (int le) +{ + int zb; + + for (zb = 0; zb < 16; ++zb) + le += le; + + return le * le; +}