[cfe-commits] r145142 - in /cfe/trunk: lib/Frontend/CompilerInvocation.cpp test/Preprocessor/optimize.c
Rafael Espindola
rafael.espindola at gmail.com
Fri Nov 25 22:21:20 PST 2011
Author: rafael
Date: Sat Nov 26 00:21:20 2011
New Revision: 145142
URL: http://llvm.org/viewvc/llvm-project?rev=145142&view=rev
Log:
Set __OPTIMIZE_SIZE__ on -Os and -Oz. This matches gcc's behaviour on both OS X
and linux.
Modified:
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/test/Preprocessor/optimize.c
Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=145142&r1=145141&r2=145142&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Sat Nov 26 00:21:20 2011
@@ -1806,7 +1806,6 @@
Opts.NoBitFieldTypeAlign = Args.hasArg(OPT_fno_bitfield_type_align);
Opts.SinglePrecisionConstants = Args.hasArg(OPT_cl_single_precision_constant);
Opts.FastRelaxedMath = Args.hasArg(OPT_cl_fast_relaxed_math);
- Opts.OptimizeSize = 0;
Opts.MRTD = Args.hasArg(OPT_mrtd);
Opts.FakeAddressSpaceMap = Args.hasArg(OPT_ffake_address_space_map);
Opts.ParseUnknownAnytype = Args.hasArg(OPT_funknown_anytype);
@@ -1823,6 +1822,7 @@
// FIXME: Eliminate this dependency.
unsigned Opt = getOptimizationLevel(Args, IK, Diags);
Opts.Optimize = Opt != 0;
+ Opts.OptimizeSize = Args.hasArg(OPT_Os) || Args.hasArg(OPT_Oz);
// This is the __NO_INLINE__ define, which just depends on things like the
// optimization level and -fno-inline, not actually whether the backend has
Modified: cfe/trunk/test/Preprocessor/optimize.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/optimize.c?rev=145142&r1=145141&r2=145142&view=diff
==============================================================================
--- cfe/trunk/test/Preprocessor/optimize.c (original)
+++ cfe/trunk/test/Preprocessor/optimize.c Sat Nov 26 00:21:20 2011
@@ -23,7 +23,7 @@
#ifndef __OPTIMIZE__
#error "__OPTIMIZE__ not defined"
#endif
- #ifdef __OPTIMIZE_SIZE__
+ #ifndef __OPTIMIZE_SIZE__
#error "__OPTIMIZE_SIZE__ not defined"
#endif
#endif
More information about the cfe-commits
mailing list