Skip to content

Commit a576b44

Browse files
committed
Merging r353402:
------------------------------------------------------------------------ r353402 | mstorsjo | 2019-02-07 13:46:49 +0100 (Thu, 07 Feb 2019) | 7 lines [clang-cl] support /Oy- on aarch64 MSVC supports /Oy- on aarch64, so clang-cl should too. Patch by Nathan Froyd! Differential Revision: https://reviews.llvm.org/D57838 ------------------------------------------------------------------------ llvm-svn: 353829
1 parent eb0faeb commit a576b44

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

clang/lib/Driver/ToolChains/MSVC.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1408,10 +1408,10 @@ static void TranslateOptArg(Arg *A, llvm::opt::DerivedArgList &DAL,
14081408
DAL.AddFlagArg(
14091409
A, Opts.getOption(options::OPT_fno_omit_frame_pointer));
14101410
} else {
1411-
// Don't warn about /Oy- in 64-bit builds (where
1411+
// Don't warn about /Oy- in x86-64 builds (where
14121412
// SupportsForcingFramePointer is false). The flag having no effect
14131413
// there is a compiler-internal optimization, and people shouldn't have
1414-
// to special-case their build files for 64-bit clang-cl.
1414+
// to special-case their build files for x86-64 clang-cl.
14151415
A->claim();
14161416
}
14171417
break;
@@ -1442,8 +1442,8 @@ MSVCToolChain::TranslateArgs(const llvm::opt::DerivedArgList &Args,
14421442
DerivedArgList *DAL = new DerivedArgList(Args.getBaseArgs());
14431443
const OptTable &Opts = getDriver().getOpts();
14441444

1445-
// /Oy and /Oy- only has an effect under X86-32.
1446-
bool SupportsForcingFramePointer = getArch() == llvm::Triple::x86;
1445+
// /Oy and /Oy- don't have an effect on X86-64
1446+
bool SupportsForcingFramePointer = getArch() != llvm::Triple::x86_64;
14471447

14481448
// The -O[12xd] flag actually expands to several flags. We must desugar the
14491449
// flags so that options embedded can be negated. For example, the '-O2' flag

clang/test/Driver/cl-options.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,10 @@
178178
// Oy_2: -momit-leaf-frame-pointer
179179
// Oy_2: -O2
180180

181+
// RUN: %clang_cl --target=aarch64-pc-windows-msvc -Werror /Oy- /O2 -### -- %s 2>&1 | FileCheck -check-prefix=Oy_aarch64 %s
182+
// Oy_aarch64: -mdisable-fp-elim
183+
// Oy_aarch64: -O2
184+
181185
// RUN: %clang_cl --target=i686-pc-win32 -Werror /O2 /O2 -### -- %s 2>&1 | FileCheck -check-prefix=O2O2 %s
182186
// O2O2: "-O2"
183187

0 commit comments

Comments
 (0)