[PATCH] D21830: Remove -mrelax-all from Clang -O0

Rafael EspĂ­ndola via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 29 08:00:26 PDT 2016


We need to benchmark this to see if it still makes a difference.

My canonical test is the .s of a lto of clang.

Cheers,
Rafael


On 29 June 2016 at 03:37, Dean Michael Berris <dberris at google.com> wrote:
> dberris created this revision.
> dberris added reviewers: echristo, rafael, grosbach.
> dberris added a subscriber: cfe-commits.
> Herald added a subscriber: mehdi_amini.
>
> Remove the -mrelax-all options passed onto the integrated assembler in
> -O0.
>
> http://reviews.llvm.org/D21830
>
> Files:
>   lib/Driver/Tools.cpp
>   test/Driver/integrated-as.c
>
> Index: test/Driver/integrated-as.c
> ===================================================================
> --- test/Driver/integrated-as.c
> +++ test/Driver/integrated-as.c
> @@ -1,7 +1,6 @@
>  // RUN: %clang -### -c -save-temps -integrated-as %s 2>&1 | FileCheck %s
>
>  // CHECK: cc1as
> -// CHECK: -mrelax-all
>
>  // RUN: %clang -### -fintegrated-as -c -save-temps %s 2>&1 | FileCheck %s -check-prefix FIAS
>
> Index: lib/Driver/Tools.cpp
> ===================================================================
> --- lib/Driver/Tools.cpp
> +++ lib/Driver/Tools.cpp
> @@ -2721,38 +2721,10 @@
>    return !UseDwarfDirectory;
>  }
>
> -/// \brief Check whether the given input tree contains any compilation actions.
> -static bool ContainsCompileAction(const Action *A) {
> -  if (isa<CompileJobAction>(A) || isa<BackendJobAction>(A))
> -    return true;
> -
> -  for (const auto &AI : A->inputs())
> -    if (ContainsCompileAction(AI))
> -      return true;
> -
> -  return false;
> -}
> -
>  /// \brief Check if -relax-all should be passed to the internal assembler.
> -/// This is done by default when compiling non-assembler source with -O0.
>  static bool UseRelaxAll(Compilation &C, const ArgList &Args) {
> -  bool RelaxDefault = true;
> -
> -  if (Arg *A = Args.getLastArg(options::OPT_O_Group))
> -    RelaxDefault = A->getOption().matches(options::OPT_O0);
> -
> -  if (RelaxDefault) {
> -    RelaxDefault = false;
> -    for (const auto &Act : C.getActions()) {
> -      if (ContainsCompileAction(Act)) {
> -        RelaxDefault = true;
> -        break;
> -      }
> -    }
> -  }
> -
>    return Args.hasFlag(options::OPT_mrelax_all, options::OPT_mno_relax_all,
> -                      RelaxDefault);
> +                      false);
>  }
>
>  // Convert an arg of the form "-gN" or "-ggdbN" or one of their aliases
>
>


More information about the cfe-commits mailing list