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

Dean Michael Berris via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 29 00:37:38 PDT 2016


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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D21830.62183.patch
Type: text/x-patch
Size: 1729 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160629/5c13f644/attachment.bin>


More information about the cfe-commits mailing list