Follow up to PR 43665.

Both "fn spec" (a TYPE_ATTRIBUTES) and -fipa-cp are important optimization
features. However, -fipa-cp can eliminate arguments and does not update "fn
spec", leading to wrong code. Thus, ipa-cp has been disabled if it encounters
an attribute, cf. PR 43665 's attachment 21714.

Expected (missed optimization):
  ipa-cp updates "fn spec" to account for the eliminated arguments.

"fn spec" allows to annotate to aid optimization via:

  /* Nonzero if the argument is not dereferenced recursively, thus only
     directly reachable memory is read or written.  */
  #define EAF_DIRECT            (1 << 0)
  /* Nonzero if memory reached by the argument is not clobbered.  */
  #define EAF_NOCLOBBER         (1 << 1)
  /* Nonzero if the argument does not escape.  */
  #define EAF_NOESCAPE          (1 << 2)
  /* Nonzero if the argument is not used by the function.  */
  #define EAF_UNUSED            (1 << 3)

And IPA-cp does a complementary optimization:

           Perform interprocedural constant propagation.  This
           optimization analyzes the program to determine when values
           passed to functions are constants and then optimizes
           accordingly.  This optimization can substantially increase
           performance if the application has constants passed to
           functions.  This flag is enabled by default at -O2, -Os and

           Summary: Re-enable IPA-CP for "fn spec"
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: burnus at gcc dot gnu dot org
 BugsThisDependsOn: 43665

Reply via email to