[llvm-commits] [dragonegg] r140381 - in /dragonegg/trunk: README src/Backend.cpp
Duncan Sands
baldrick at free.fr
Fri Sep 23 08:21:11 PDT 2011
Author: baldrick
Date: Fri Sep 23 10:21:11 2011
New Revision: 140381
URL: http://llvm.org/viewvc/llvm-project?rev=140381&view=rev
Log:
When GCC optimizations are enabled, by default we were doing almost no LLVM
optimization (just simplifycfg+scalarrepl+earlycse). While this is amusing,
experiments show that -O1 is a better choice. So set things up so that is
what you get by default when running the GCC optimizers at -O3. If anyone
wants more LLVM optimization, they can either run the GCC optimizers at -O4
or -O6 (which doesn't cause GCC to do any more optimization; instead it bumps
the level of LLVM optimization up to -O2 and -O3 respectively), or explicitly
ask for an LLVM optimization level using the option
-fplugin-arg-dragonegg-llvm-ir-optimize=level.
Modified:
dragonegg/trunk/README
dragonegg/trunk/src/Backend.cpp
Modified: dragonegg/trunk/README
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/README?rev=140381&r1=140380&r2=140381&view=diff
==============================================================================
--- dragonegg/trunk/README (original)
+++ dragonegg/trunk/README Fri Sep 23 10:21:11 2011
@@ -112,9 +112,9 @@
-fplugin-arg-dragonegg-enable-gcc-optzns
Run the GCC tree optimizers rather than the LLVM IR optimizers (normally all
- GCC optimizations are disabled). This disables the LLVM IR optimizers, except
- for a small set of cleanup passes (to override this and run the usual set of
- LLVM IR optimizers, use the -fplugin-arg-dragonegg-llvm-ir-optimize option).
+ GCC optimizations are disabled). By default this severely reduces the amount
+ of LLVM IR optimization. Use -O4 to -O6 to have LLVM optimize harder, or set
+ an explicit level using the -fplugin-arg-dragonegg-llvm-ir-optimize option.
-fplugin-arg-dragonegg-save-gcc-output
GCC assembler output is normally redirected to /dev/null so that it doesn't
Modified: dragonegg/trunk/src/Backend.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Backend.cpp?rev=140381&r1=140380&r2=140381&view=diff
==============================================================================
--- dragonegg/trunk/src/Backend.cpp (original)
+++ dragonegg/trunk/src/Backend.cpp Fri Sep 23 10:21:11 2011
@@ -207,16 +207,39 @@
/// PerFunctionOptLevel - The optimization level to be used by the per-function
/// IR optimizers.
static int PerFunctionOptLevel() {
- return LLVMIROptimizeArg >= 0 ? LLVMIROptimizeArg : optimize;
+ // If the user supplied an LLVM optimization level then use it.
+ if (LLVMIROptimizeArg >= 0)
+ return LLVMIROptimizeArg;
+ // If the GCC optimizers were run then tone down the LLVM optimization level:
+ // GCC | LLVM
+ // ----------
+ // 0 | 0
+ // >= 1 | 1 (per-function maximum)
+ if (EnableGCCOptimizations)
+ return optimize > 0;
+ // Otherwise use the GCC optimization level.
+ return optimize;
}
/// ModuleOptLevel - The optimization level to be used by the module level IR
/// optimizers.
static int ModuleOptLevel() {
+ // If the user supplied an LLVM optimization level then use it.
if (LLVMIROptimizeArg >= 0)
return LLVMIROptimizeArg;
+ // If the GCC optimizers were run then tone down the LLVM optimization level:
+ // GCC | LLVM
+ // ----------
+ // 0 | 0
+ // 1 | 0
+ // 2 | 1
+ // 3 | 1
+ // 4 | 2
+ // 5 | 2
+ // >= 6 | 3 (per-module maximum)
if (EnableGCCOptimizations)
- return 0;
+ return optimize / 2;
+ // Otherwise use the GCC optimization level.
return optimize;
}
More information about the llvm-commits
mailing list