When searching for an usable algorithm with -minline-all-stringops,
decide_alg stops when it sees libcall even if there is a usable
algorithm. It goes into an infinite loop. This patch changes
decide_alg to stop searching only if there aren't any usable algorithms.
Testd on Linux/x86-64.
gcc/
PR target/64108
* config/i386/i386.c (decide_alg): Stop only if there aren't
any usable algorithms.
gcc/testsuite/
PR target/64108
* gcc.target/i386/memset-strategy-2.c: New test.
From-SVN: r218272
+2014-12-02 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR target/64108
+ * config/i386/i386.c (decide_alg): Stop only if there aren't
+ any usable algorithms.
+
2014-12-02 Tom de Vries <tom@codesourcery.com>
PR rtl-optimization/63718
*noalign = alg_noalign;
return alg;
}
- break;
+ else if (!any_alg_usable_p)
+ break;
}
else if (alg_usable_p (candidate, memset))
{
+2014-12-02 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR target/64108
+ * gcc.target/i386/memset-strategy-2.c: New test.
+
2014-12-02 Richard Biener <rguenther@suse.de>
* gcc.dg/torture/20141202-1.c: New testcase.
--- /dev/null
+/* PR target/64108 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=atom -mmemset-strategy=libcall:-1:align -minline-all-stringops" } */
+
+char a[2048];
+void t (void)
+{
+ __builtin_memset (a, 1, 2048);
+}
+