[Bug tree-optimization/90917] Propagate constants into loads if dominated by str(n)cmp/memcmp

msebor at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Jun 20 03:30:00 GMT 2019


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90917

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2019-06-20
                 CC|                            |msebor at gcc dot gnu.org
             Blocks|                            |83819
     Ever confirmed|0                           |1

--- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> ---
My hope is to ultimately fold the following (and the snprintf equivalents), as
part of the solution for pr83431.

  void f (const char *s)
  { 
    int n = __builtin_strlen (s);
    if (n == __builtin_strlen ("123"))
      if (3 != __builtin_strlen (s))
        __builtin_abort ();
  }

Propagating the strings themselves is more challenging, but might be doable at
least in the simple cases.  So confirmed.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83819
[Bug 83819] [meta-bug] missing strlen optimizations


More information about the Gcc-bugs mailing list