[clang] 28e0798 - Revert "[Clang][AArch64][Darwin] Enable GlobalISel by default for Darwin ARM64 platforms."

Alex Brachet via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 11 11:40:38 PST 2022


Author: Alex Brachet
Date: 2022-11-11T19:40:08Z
New Revision: 28e07984c3427908c9b423c7ed0cf6ac3064c5d8

URL: https://github.com/llvm/llvm-project/commit/28e07984c3427908c9b423c7ed0cf6ac3064c5d8
DIFF: https://github.com/llvm/llvm-project/commit/28e07984c3427908c9b423c7ed0cf6ac3064c5d8.diff

LOG: Revert "[Clang][AArch64][Darwin] Enable GlobalISel by default for Darwin ARM64 platforms."

This reverts commit f64802e8d3e9db299cad913ffcb734c8d35dc5f0.

Added: 
    

Modified: 
    clang/lib/Driver/ToolChains/Clang.cpp
    clang/lib/Driver/ToolChains/Darwin.cpp
    clang/test/Driver/global-isel.c

Removed: 
    


################################################################################
diff  --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index 217a277b1f2d..90c4bb51c6ec 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -7225,29 +7225,15 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
   if (SplitLTOUnit)
     CmdArgs.push_back("-fsplit-lto-unit");
 
-  A = Args.getLastArg(options::OPT_fglobal_isel, options::OPT_fno_global_isel);
-  // If a configuration is fully supported, we don't issue any warnings or
-  // remarks.
-  bool IsFullySupported = getToolChain().getTriple().isOSDarwin() &&
-                          Triple.getArch() == llvm::Triple::aarch64;
-  if (IsFullySupported) {
-    if (A && A->getOption().matches(options::OPT_fno_global_isel)) {
-      CmdArgs.push_back("-mllvm");
-      CmdArgs.push_back("-global-isel=0");
-    } else {
-      CmdArgs.push_back("-mllvm");
-      CmdArgs.push_back("-global-isel=1");
-      CmdArgs.push_back("-mllvm");
-      CmdArgs.push_back("-global-isel-abort=0");
-    }
-  } else if (A) {
+  if (Arg *A = Args.getLastArg(options::OPT_fglobal_isel,
+                               options::OPT_fno_global_isel)) {
     CmdArgs.push_back("-mllvm");
     if (A->getOption().matches(options::OPT_fglobal_isel)) {
       CmdArgs.push_back("-global-isel=1");
 
       // GISel is on by default on AArch64 -O0, so don't bother adding
       // the fallback remarks for it. Other combinations will add a warning of
-      // some kind, unless we're on Darwin.
+      // some kind.
       bool IsArchSupported = Triple.getArch() == llvm::Triple::aarch64;
       bool IsOptLevelSupported = false;
 

diff  --git a/clang/lib/Driver/ToolChains/Darwin.cpp b/clang/lib/Driver/ToolChains/Darwin.cpp
index 848b81ab54a2..333d99842e23 100644
--- a/clang/lib/Driver/ToolChains/Darwin.cpp
+++ b/clang/lib/Driver/ToolChains/Darwin.cpp
@@ -381,11 +381,10 @@ void darwin::Linker::AddLinkArgs(Compilation &C, const ArgList &Args,
       D.Diag(diag::err_drv_bitcode_unsupported_on_toolchain);
   }
 
-  // GlobalISel is enabled by default on AArch64 Darwin.
-  if (getToolChain().getArch() == llvm::Triple::aarch64) {
-    Arg *A = Args.getLastArg(options::OPT_fglobal_isel,
-                             options::OPT_fno_global_isel);
-    if (!A || !A->getOption().matches(options::OPT_fno_global_isel)) {
+  // If GlobalISel is enabled, pass it through to LLVM.
+  if (Arg *A = Args.getLastArg(options::OPT_fglobal_isel,
+                               options::OPT_fno_global_isel)) {
+    if (A->getOption().matches(options::OPT_fglobal_isel)) {
       CmdArgs.push_back("-mllvm");
       CmdArgs.push_back("-global-isel");
       // Disable abort and fall back to SDAG silently.

diff  --git a/clang/test/Driver/global-isel.c b/clang/test/Driver/global-isel.c
index 0d3bd2b2fe26..66f196b03c1e 100644
--- a/clang/test/Driver/global-isel.c
+++ b/clang/test/Driver/global-isel.c
@@ -6,7 +6,6 @@
 // RUN: %clang -target aarch64 -fglobal-isel -S %s -### 2>&1 | FileCheck --check-prefix=ARM64-DEFAULT %s
 // RUN: %clang -target aarch64 -fglobal-isel -S -O0 %s -### 2>&1 | FileCheck --check-prefix=ARM64-O0 %s
 // RUN: %clang -target aarch64 -fglobal-isel -S -O2 %s -### 2>&1 | FileCheck --check-prefix=ARM64-O2 %s
-// RUN: %clang -arch arm64 -fglobal-isel -S -O2 %s -### 2>&1 | FileCheck --check-prefixes=DARWIN-ARM64-O2,ENABLED %s
 // RUN: %clang -target aarch64 -fglobal-isel -Wno-global-isel -S -O2 %s -### 2>&1 | FileCheck --check-prefix=ARM64-O2-NOWARN %s
 
 // RUN: %clang -target x86_64 -fglobal-isel -S %s -### 2>&1 | FileCheck --check-prefix=X86_64 %s
@@ -28,7 +27,6 @@
 // ARM64-DEFAULT-NOT: warning: -fglobal-isel
 // ARM64-DEFAULT-NOT: "-global-isel-abort=2"
 // ARM64-O0-NOT: warning: -fglobal-isel
-// DARWIN-ARM64-O2-NOT: warning: -fglobal-isel
 // ARM64-O2: warning: -fglobal-isel support is incomplete for this architecture at the current optimization level
 // ARM64-O2: "-mllvm" "-global-isel-abort=2"
 // ARM64-O2-NOWARN-NOT: warning: -fglobal-isel


        


More information about the cfe-commits mailing list