Make the -mno-global-merge option work for arm64/aarch64. rdar://17024719
authorBob Wilson <bob.wilson@apple.com>
Thu, 29 May 2014 19:43:02 +0000 (19:43 +0000)
committerBob Wilson <bob.wilson@apple.com>
Thu, 29 May 2014 19:43:02 +0000 (19:43 +0000)
llvm-svn: 209836

clang/lib/Driver/Tools.cpp
clang/test/Driver/mno-global-merge.c

index 19816f7..b623e10 100644 (file)
@@ -897,6 +897,14 @@ void Clang::AddAArch64TargetArgs(const ArgList &Args,
     CmdArgs.push_back("-backend-option");
     CmdArgs.push_back("-aarch64-strict-align");
   }
+
+  // Setting -mno-global-merge disables the codegen global merge pass. Setting
+  // -mglobal-merge has no effect as the pass is enabled by default.
+  if (Arg *A = Args.getLastArg(options::OPT_mglobal_merge,
+                               options::OPT_mno_global_merge)) {
+    if (A->getOption().matches(options::OPT_mno_global_merge))
+      CmdArgs.push_back("-mno-global-merge");
+  }
 }
 
 // Get CPU and ABI names. They are not independent
index ec9f69e..a17848f 100644 (file)
@@ -2,11 +2,19 @@
 // RUN:   -mno-global-merge -### -fsyntax-only %s 2> %t
 // RUN: FileCheck --check-prefix=CHECK-NGM < %t %s
 
+// RUN: %clang -target arm64-apple-ios7 \
+// RUN:   -mno-global-merge -### -fsyntax-only %s 2> %t
+// RUN: FileCheck --check-prefix=CHECK-NGM < %t %s
+
 // CHECK-NGM: "-mno-global-merge"
 
 // RUN: %clang -target armv7-apple-darwin10 \
 // RUN:   -mglobal-merge -### -fsyntax-only %s 2> %t
 // RUN: FileCheck --check-prefix=CHECK-GM < %t %s
 
+// RUN: %clang -target arm64-apple-ios7 \
+// RUN:   -mglobal-merge -### -fsyntax-only %s 2> %t
+// RUN: FileCheck --check-prefix=CHECK-GM < %t %s
+
 // CHECK-GM-NOT: "-mglobal-merge"