Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions test/HLSL/opt/help.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
; RUN: opt -help | FileCheck %s

; Make sure the help message is printed.
; CHECK: -O1
; CHECK-SAME: - Optimization level 1. Similar to clang -O1
10 changes: 10 additions & 0 deletions tools/opt/opt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@ StandardLinkOpts("std-link-opts",
cl::desc("Include the standard link time optimizations"));
#endif // HLSL Change Ends

// HLSL Change Starts: add help option.
static cl::opt<bool> Help("help", cl::desc("Print help"));
// HLSL Change Ends

static cl::opt<bool>
OptLevelO1("O1",
cl::desc("Optimization level 1. Similar to clang -O1"));
Expand Down Expand Up @@ -383,6 +387,12 @@ int __cdecl main(int argc, char **argv) {

cl::ParseCommandLineOptions(argc, argv,
"llvm .bc -> .bc modular optimizer and analysis printer\n");
// HLSL Change Starts: add help option.
if (Help) {
cl::PrintHelpMessage();
return 2;
}
// HLSL Change Ends

if (AnalyzeOnly && NoOutput) {
errs() << argv[0] << ": analyze mode conflicts with no-output mode.\n";
Expand Down
Loading