]> granicus.if.org Git - clang/commitdiff
[clang-cl] support /Oy- on aarch64
authorMartin Storsjo <martin@martin.st>
Thu, 7 Feb 2019 12:46:49 +0000 (12:46 +0000)
committerMartin Storsjo <martin@martin.st>
Thu, 7 Feb 2019 12:46:49 +0000 (12:46 +0000)
MSVC supports /Oy- on aarch64, so clang-cl should too.

Patch by Nathan Froyd!

Differential Revision: https://reviews.llvm.org/D57838

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@353402 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Driver/ToolChains/MSVC.cpp
test/Driver/cl-options.c

index 8909cd01dccf3ae08b5bee1cea5f9e37fcad727e..139e8543c6aca2dbcd29ee7246779639efe81f87 100644 (file)
@@ -1407,10 +1407,10 @@ static void TranslateOptArg(Arg *A, llvm::opt::DerivedArgList &DAL,
           DAL.AddFlagArg(
               A, Opts.getOption(options::OPT_fno_omit_frame_pointer));
       } else {
-        // Don't warn about /Oy- in 64-bit builds (where
+        // Don't warn about /Oy- in x86-64 builds (where
         // SupportsForcingFramePointer is false).  The flag having no effect
         // there is a compiler-internal optimization, and people shouldn't have
-        // to special-case their build files for 64-bit clang-cl.
+        // to special-case their build files for x86-64 clang-cl.
         A->claim();
       }
       break;
@@ -1441,8 +1441,8 @@ MSVCToolChain::TranslateArgs(const llvm::opt::DerivedArgList &Args,
   DerivedArgList *DAL = new DerivedArgList(Args.getBaseArgs());
   const OptTable &Opts = getDriver().getOpts();
 
-  // /Oy and /Oy- only has an effect under X86-32.
-  bool SupportsForcingFramePointer = getArch() == llvm::Triple::x86;
+  // /Oy and /Oy- don't have an effect on X86-64
+  bool SupportsForcingFramePointer = getArch() != llvm::Triple::x86_64;
 
   // The -O[12xd] flag actually expands to several flags.  We must desugar the
   // flags so that options embedded can be negated.  For example, the '-O2' flag
index 4087ef3b8c324e6fba371adeae062828182efd79..1fa2ae3914b1e3140eb0349fd2794b9f56d2f06b 100644 (file)
 // Oy_2: -momit-leaf-frame-pointer
 // Oy_2: -O2
 
+// RUN: %clang_cl --target=aarch64-pc-windows-msvc -Werror /Oy- /O2 -### -- %s 2>&1 | FileCheck -check-prefix=Oy_aarch64 %s
+// Oy_aarch64: -mdisable-fp-elim
+// Oy_aarch64: -O2
+
 // RUN: %clang_cl --target=i686-pc-win32 -Werror /O2 /O2 -### -- %s 2>&1 | FileCheck -check-prefix=O2O2 %s
 // O2O2: "-O2"