[clang] [Driver][MachineOutliner] Support -moutline option for aarch64_be (PR #73223)
dong jianqiang via cfe-commits
cfe-commits at lists.llvm.org
Wed Dec 6 23:51:17 PST 2023
https://github.com/dongjianqiang2 updated https://github.com/llvm/llvm-project/pull/73223
>From 438da675d853e0b1bc38670c18361d7d3615f860 Mon Sep 17 00:00:00 2001
From: dong jianqiang <dongjianqiang2 at 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 | 4 +---
clang/test/Driver/aarch64-outliner.c | 2 ++
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp
index 1f31c6395206e..4dc471ddc098f 100644
--- a/clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -2398,9 +2398,7 @@ void tools::addMachineOutlinerArgs(const Driver &D,
// We only support -moutline in AArch64 and ARM targets right now. If
// we're not compiling for these, emit a warning and ignore the flag.
// Otherwise, add the proper mllvm flags.
- if (!(Triple.isARM() || Triple.isThumb() ||
- Triple.getArch() == llvm::Triple::aarch64 ||
- Triple.getArch() == llvm::Triple::aarch64_32)) {
+ if (!(Triple.isARM() || Triple.isThumb() || Triple.isAArch64())) {
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 42e43b433e282..06e5de11ec49e 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]
More information about the cfe-commits
mailing list