+2018-07-26 Qing Zhao <qing.zhao@oracle.com>
+
+ * builtins.c (inline_expand_builtin_string_cmp): Disable inlining
+ when optimization level is lower than 2 or optimize for size.
+
2018-07-26 Martin Sebor <msebor@redhat.com>
PR tree-optimization/86043
unsigned HOST_WIDE_INT length = 0;
bool is_ncmp = (fcode == BUILT_IN_STRNCMP || fcode == BUILT_IN_MEMCMP);
+ /* Do NOT apply this inlining expansion when optimizing for size or
+ optimization level below 2. */
+ if (optimize < 2 || optimize_insn_for_size_p ())
+ return NULL_RTX;
+
gcc_checking_assert (fcode == BUILT_IN_STRCMP
|| fcode == BUILT_IN_STRNCMP
|| fcode == BUILT_IN_MEMCMP);
+2018-07-26 Qing Zhao <qing.zhao@oracle.com>
+
+ * gcc.dg/strcmpopt_5.c: Change to O2 to enable the transformation.
+ * gcc.dg/strcmpopt_6.c: Likewise.
+
2018-07-26 Pat Haugen <pthaugen@us.ibm.com>
PR target/86612
/* { dg-do run } */
-/* { dg-options "-O -fdump-rtl-expand" } */
+/* { dg-options "-O2 -fdump-rtl-expand" } */
typedef struct { char s[8]; int x; } S;
__attribute__ ((noinline)) int
/* When the specified length exceeds one of the arguments of the call to memcmp,
the call to memcmp should NOT be inlined. */
/* { dg-do run } */
-/* { dg-options "-O -fdump-rtl-expand -Wno-stringop-overflow" } */
+/* { dg-options "-O2 -fdump-rtl-expand -Wno-stringop-overflow" } */
typedef struct { char s[8]; int x; } S;
}
-/* { dg-final { scan-rtl-dump-times "__builtin_memcmp" 4 "expand" } } */
+/* { dg-final { scan-rtl-dump-times "__builtin_memcmp" 6 "expand" } } */