[PATCH] D125196: [opt] Error on `opt -O# --foo-pass`
Arthur Eubanks via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun May 8 17:25:04 PDT 2022
aeubanks created this revision.
aeubanks added a reviewer: asbirlea.
Herald added a project: All.
aeubanks requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Matches the error message we emit with `-opt -O# --passes=foo`.
Otherwise we crash later on.
Makes #55320 much less confusing.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D125196
Files:
llvm/test/Other/opt-On.ll
llvm/tools/opt/opt.cpp
Index: llvm/tools/opt/opt.cpp
===================================================================
--- llvm/tools/opt/opt.cpp
+++ llvm/tools/opt/opt.cpp
@@ -780,8 +780,9 @@
errs() << "Cannot specify multiple -O#\n";
return 1;
}
- if (NumOLevel > 0 && PassPipeline.getNumOccurrences() > 0) {
- errs() << "Cannot specify -O# and --passes=, use "
+ if (NumOLevel > 0 &&
+ (PassPipeline.getNumOccurrences() > 0 || PassList.size() > 0)) {
+ errs() << "Cannot specify -O# and --passes=/--foo-pass, use "
"-passes='default<O#>,other-pass'\n";
return 1;
}
Index: llvm/test/Other/opt-On.ll
===================================================================
--- llvm/test/Other/opt-On.ll
+++ llvm/test/Other/opt-On.ll
@@ -1,5 +1,6 @@
; RUN: not opt -O1 -O2 < %s 2>&1 | FileCheck %s --check-prefix=MULTIPLE
; RUN: not opt -O1 -passes='no-op-module' < %s 2>&1 | FileCheck %s --check-prefix=BOTH
+; RUN: not opt -O1 --gvn < %s 2>&1 | FileCheck %s --check-prefix=BOTH
; RUN: opt -O0 < %s -S 2>&1 | FileCheck %s --check-prefix=OPT
; RUN: opt -O1 < %s -S 2>&1 | FileCheck %s --check-prefix=OPT
; RUN: opt -O2 < %s -S 2>&1 | FileCheck %s --check-prefix=OPT
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D125196.427961.patch
Type: text/x-patch
Size: 1216 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220509/f17a93f5/attachment.bin>
More information about the llvm-commits
mailing list