From 17d2e8789cce457db238058c824796b34e56a473 Mon Sep 17 00:00:00 2001 From: Chad Rosier Date: Tue, 26 Jan 2016 15:52:05 +0000 Subject: [PATCH] [Driver] Make sure -fno-math-builtin option is being passed by the driver. Support for the -fno-math-builtin option was added in r186899. The codegen side is being tested in test/CodeGen/nomathbuiltin.c. The missing part was just passing the option through the driver. PR26317 llvm-svn: 258814 --- clang/lib/Driver/Tools.cpp | 5 +++-- clang/test/CodeGen/nomathbuiltin.c | 1 - clang/test/Driver/clang_f_opts.c | 3 +++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp index faec8a1c3f8f..a53319202f33 100644 --- a/clang/lib/Driver/Tools.cpp +++ b/clang/lib/Driver/Tools.cpp @@ -5465,12 +5465,13 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, options::OPT_fno_apple_pragma_pack, false)) CmdArgs.push_back("-fapple-pragma-pack"); + // Process -fno-math-builtin options. // le32-specific flags: // -fno-math-builtin: clang should not convert math builtins to intrinsics // by default. - if (getToolChain().getArch() == llvm::Triple::le32) { + if (Args.hasArg(options::OPT_fno_math_builtin) || + getToolChain().getArch() == llvm::Triple::le32) CmdArgs.push_back("-fno-math-builtin"); - } // Default to -fno-builtin-str{cat,cpy} on Darwin for ARM. // diff --git a/clang/test/CodeGen/nomathbuiltin.c b/clang/test/CodeGen/nomathbuiltin.c index 35e7c567e68d..86dc4e363ea9 100644 --- a/clang/test/CodeGen/nomathbuiltin.c +++ b/clang/test/CodeGen/nomathbuiltin.c @@ -9,4 +9,3 @@ double foo(double a, double b) { return pow(a, b); // CHECK: call {{.*}}double @pow } - diff --git a/clang/test/Driver/clang_f_opts.c b/clang/test/Driver/clang_f_opts.c index 25a1930bdd6d..bfe80045503f 100644 --- a/clang/test/Driver/clang_f_opts.c +++ b/clang/test/Driver/clang_f_opts.c @@ -191,6 +191,9 @@ // RUN: %clang -### -S -fexec-charset=iso-8859-1 -o /dev/null %s 2>&1 | FileCheck -check-prefix=CHECK-INVALID-INPUT-CHARSET %s // CHECK-INVALID-INPUT-CHARSET: error: invalid value 'iso-8859-1' in '-fexec-charset=iso-8859-1' +// RUN: %clang -### -S -fno-math-builtin %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MATH-BUILTIN %s +// CHECK-NO-MATH-BUILTIN: "-fno-math-builtin" + // Test that we don't error on these. // RUN: %clang -### -S -Werror \ // RUN: -falign-functions -falign-functions=2 -fno-align-functions \