[PATCH] D23208: opt: Adding -O0 to opt tool
Gor Nishanov via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 5 09:35:28 PDT 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL277829: opt: Adding -O0 to opt tool (authored by GorNishanov).
Changed prior to commit:
https://reviews.llvm.org/D23208?vs=66959&id=66969#toc
Repository:
rL LLVM
https://reviews.llvm.org/D23208
Files:
llvm/trunk/test/Transforms/Coroutines/smoketest.ll
llvm/trunk/tools/opt/opt.cpp
Index: llvm/trunk/test/Transforms/Coroutines/smoketest.ll
===================================================================
--- llvm/trunk/test/Transforms/Coroutines/smoketest.ll
+++ llvm/trunk/test/Transforms/Coroutines/smoketest.ll
@@ -1,6 +1,7 @@
; Test that all coroutine passes run in the correct order at all optimization
; levels and -disable-coroutines removes coroutine passes from the pipeline.
;
+; RUN: opt < %s -disable-output -enable-coroutines -debug-pass=Arguments -O0 2>&1 | FileCheck %s
; RUN: opt < %s -disable-output -enable-coroutines -debug-pass=Arguments -O1 2>&1 | FileCheck %s
; RUN: opt < %s -disable-output -enable-coroutines -debug-pass=Arguments -O2 2>&1 | FileCheck %s
; RUN: opt < %s -disable-output -enable-coroutines -debug-pass=Arguments -O3 2>&1 | FileCheck %s
Index: llvm/trunk/tools/opt/opt.cpp
===================================================================
--- llvm/trunk/tools/opt/opt.cpp
+++ llvm/trunk/tools/opt/opt.cpp
@@ -122,6 +122,10 @@
cl::desc("Include the standard link time optimizations"));
static cl::opt<bool>
+OptLevelO0("O0",
+ cl::desc("Optimization level 0. Similar to clang -O0"));
+
+static cl::opt<bool>
OptLevelO1("O1",
cl::desc("Optimization level 1. Similar to clang -O1"));
@@ -515,7 +519,8 @@
: TargetIRAnalysis()));
std::unique_ptr<legacy::FunctionPassManager> FPasses;
- if (OptLevelO1 || OptLevelO2 || OptLevelOs || OptLevelOz || OptLevelO3) {
+ if (OptLevelO0 || OptLevelO1 || OptLevelO2 || OptLevelOs || OptLevelOz ||
+ OptLevelO3) {
FPasses.reset(new legacy::FunctionPassManager(M.get()));
FPasses->add(createTargetTransformInfoWrapperPass(
TM ? TM->getTargetIRAnalysis() : TargetIRAnalysis()));
@@ -547,6 +552,11 @@
StandardLinkOpts = false;
}
+ if (OptLevelO0 && OptLevelO0.getPosition() < PassList.getPosition(i)) {
+ AddOptimizationPasses(Passes, *FPasses, TM.get(), 0, 0);
+ OptLevelO0 = false;
+ }
+
if (OptLevelO1 && OptLevelO1.getPosition() < PassList.getPosition(i)) {
AddOptimizationPasses(Passes, *FPasses, TM.get(), 1, 0);
OptLevelO1 = false;
@@ -619,6 +629,9 @@
StandardLinkOpts = false;
}
+ if (OptLevelO0)
+ AddOptimizationPasses(Passes, *FPasses, TM.get(), 0, 0);
+
if (OptLevelO1)
AddOptimizationPasses(Passes, *FPasses, TM.get(), 1, 0);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23208.66969.patch
Type: text/x-patch
Size: 2433 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160805/c391c7c9/attachment.bin>
More information about the llvm-commits
mailing list