https://github.com/dongjianqiang2 updated 
https://github.com/llvm/llvm-project/pull/73223

>From 5742f71b9077a038cfefe4c74290d7e9d2f42d3f Mon Sep 17 00:00:00 2001
From: dong jianqiang <dongjianqia...@huawei.com>
Date: Thu, 23 Nov 2023 16:58:11 +0800
Subject: [PATCH] [Driver][MachineOutliner] Support outlining option with LTO
 for aarch64_be

This patch propagates the -moutline option when target is aarch64_be,
fix warning: 'aarch64_be' does not support '-moutline'; flag ignored 
[-Woption-ignored]
---
 clang/lib/Driver/ToolChains/CommonArgs.cpp | 3 ++-
 clang/test/Driver/aarch64-outliner.c       | 2 ++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp 
b/clang/lib/Driver/ToolChains/CommonArgs.cpp
index 5d2cd1959b06925..078f2ff80a21939 100644
--- a/clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -2436,7 +2436,8 @@ void tools::addMachineOutlinerArgs(const Driver &D,
       // Otherwise, add the proper mllvm flags.
       if (!(Triple.isARM() || Triple.isThumb() ||
             Triple.getArch() == llvm::Triple::aarch64 ||
-            Triple.getArch() == llvm::Triple::aarch64_32)) {
+            Triple.getArch() == llvm::Triple::aarch64_32 ||
+            Triple.getArch() == llvm::Triple::aarch64_be)) {
         D.Diag(diag::warn_drv_moutline_unsupported_opt) << 
Triple.getArchName();
       } else {
         addArg(Twine("-enable-machine-outliner"));
diff --git a/clang/test/Driver/aarch64-outliner.c 
b/clang/test/Driver/aarch64-outliner.c
index 42e43b433e282d3..06e5de11ec49ecd 100644
--- a/clang/test/Driver/aarch64-outliner.c
+++ b/clang/test/Driver/aarch64-outliner.c
@@ -1,7 +1,9 @@
 // REQUIRES: aarch64-registered-target
 // RUN: %clang --target=aarch64 -moutline -S %s -### 2>&1 | FileCheck %s 
-check-prefix=ON
+// RUN: %clang --target=aarch64_be -moutline -S %s -### 2>&1 | FileCheck %s 
-check-prefix=ON
 // ON: "-mllvm" "-enable-machine-outliner"
 // RUN: %clang --target=aarch64 -moutline -mno-outline -S %s -### 2>&1 | 
FileCheck %s -check-prefix=OFF
+// RUN: %clang --target=aarch64_be -moutline -mno-outline -S %s -### 2>&1 | 
FileCheck %s -check-prefix=OFF
 // OFF: "-mllvm" "-enable-machine-outliner=never"
 // RUN: %clang --target=x86_64 -moutline -S %s -### 2>&1 | FileCheck %s 
-check-prefix=WARN
 // WARN: warning: 'x86_64' does not support '-moutline'; flag ignored 
[-Woption-ignored]

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to