Disable strcmp/strncmp/memcmp inlining when optimization
level is lower than 2 or Os From-SVN: r263028
This commit is contained in:
parent
543f1a0422
commit
3d592d2d56
5 changed files with 18 additions and 3 deletions
|
@ -1,3 +1,8 @@
|
|||
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
|
||||
|
|
|
@ -6854,6 +6854,11 @@ inline_expand_builtin_string_cmp (tree exp, rtx target)
|
|||
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);
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* { 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
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* 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;
|
||||
|
||||
|
@ -33,4 +33,4 @@ int main (void)
|
|||
|
||||
}
|
||||
|
||||
/* { dg-final { scan-rtl-dump-times "__builtin_memcmp" 4 "expand" } } */
|
||||
/* { dg-final { scan-rtl-dump-times "__builtin_memcmp" 6 "expand" } } */
|
||||
|
|
Loading…
Add table
Reference in a new issue