summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorFedor Sergeev <fedor.sergeev@azul.com>2018-10-17 10:36:23 +0000
committerFedor Sergeev <fedor.sergeev@azul.com>2018-10-17 10:36:23 +0000
commitbd6b2138b94a47a9226ec1e69bf3be55a47fd1ef (patch)
treede58f3925965bf772e2becdad7ff066b456d90ed /llvm/test
parent8a08412533536cf433097817e9f155a4ce68252b (diff)
downloadbcm5719-llvm-bd6b2138b94a47a9226ec1e69bf3be55a47fd1ef.tar.gz
bcm5719-llvm-bd6b2138b94a47a9226ec1e69bf3be55a47fd1ef.zip
[NewPM] teach -passes= to emit meaningful error messages
All the PassBuilder::parse interfaces now return descriptive StringError instead of a plain bool. It allows to make -passes/aa-pipeline parsing errors context-specific and thus less confusing. TODO: ideally we should also make suggestions for misspelled pass names, but that requires some extensions to PassBuilder. Reviewed By: philip.pfaffe, chandlerc Differential Revision: https://reviews.llvm.org/D53246 llvm-svn: 344685
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/Other/pass-pipeline-parsing.ll83
-rw-r--r--llvm/test/tools/llvm-lto2/X86/pipeline.ll4
-rw-r--r--llvm/test/tools/llvm-opt-fuzzer/command-line.ll2
3 files changed, 69 insertions, 20 deletions
diff --git a/llvm/test/Other/pass-pipeline-parsing.ll b/llvm/test/Other/pass-pipeline-parsing.ll
index b303318c796..d26d000ec8d 100644
--- a/llvm/test/Other/pass-pipeline-parsing.ll
+++ b/llvm/test/Other/pass-pipeline-parsing.ll
@@ -54,52 +54,52 @@
; RUN: not opt -disable-output -debug-pass-manager \
; RUN: -passes='no-op-module)' %s 2>&1 \
; RUN: | FileCheck %s --check-prefix=CHECK-UNBALANCED1
-; CHECK-UNBALANCED1: unable to parse pass pipeline description
+; CHECK-UNBALANCED1: invalid pipeline 'no-op-module)'
; RUN: not opt -disable-output -debug-pass-manager \
; RUN: -passes='module(no-op-module))' %s 2>&1 \
; RUN: | FileCheck %s --check-prefix=CHECK-UNBALANCED2
-; CHECK-UNBALANCED2: unable to parse pass pipeline description
+; CHECK-UNBALANCED2: invalid pipeline 'module(no-op-module))'
; RUN: not opt -disable-output -debug-pass-manager \
; RUN: -passes='module(no-op-module' %s 2>&1 \
; RUN: | FileCheck %s --check-prefix=CHECK-UNBALANCED3
-; CHECK-UNBALANCED3: unable to parse pass pipeline description
+; CHECK-UNBALANCED3: invalid pipeline 'module(no-op-module'
; RUN: not opt -disable-output -debug-pass-manager \
; RUN: -passes='no-op-function)' %s 2>&1 \
; RUN: | FileCheck %s --check-prefix=CHECK-UNBALANCED4
-; CHECK-UNBALANCED4: unable to parse pass pipeline description
+; CHECK-UNBALANCED4: invalid pipeline 'no-op-function)'
; RUN: not opt -disable-output -debug-pass-manager \
; RUN: -passes='function(no-op-function))' %s 2>&1 \
; RUN: | FileCheck %s --check-prefix=CHECK-UNBALANCED5
-; CHECK-UNBALANCED5: unable to parse pass pipeline description
+; CHECK-UNBALANCED5: invalid pipeline 'function(no-op-function))'
; RUN: not opt -disable-output -debug-pass-manager \
; RUN: -passes='function(function(no-op-function)))' %s 2>&1 \
; RUN: | FileCheck %s --check-prefix=CHECK-UNBALANCED6
-; CHECK-UNBALANCED6: unable to parse pass pipeline description
+; CHECK-UNBALANCED6: invalid pipeline 'function(function(no-op-function)))'
; RUN: not opt -disable-output -debug-pass-manager \
; RUN: -passes='function(no-op-function' %s 2>&1 \
; RUN: | FileCheck %s --check-prefix=CHECK-UNBALANCED7
-; CHECK-UNBALANCED7: unable to parse pass pipeline description
+; CHECK-UNBALANCED7: invalid pipeline 'function(no-op-function'
; RUN: not opt -disable-output -debug-pass-manager \
; RUN: -passes='function(function(no-op-function)' %s 2>&1 \
; RUN: | FileCheck %s --check-prefix=CHECK-UNBALANCED8
-; CHECK-UNBALANCED8: unable to parse pass pipeline description
+; CHECK-UNBALANCED8: invalid pipeline 'function(function(no-op-function)'
; RUN: not opt -disable-output -debug-pass-manager \
; RUN: -passes='no-op-module,)' %s 2>&1 \
; RUN: | FileCheck %s --check-prefix=CHECK-UNBALANCED9
-; CHECK-UNBALANCED9: unable to parse pass pipeline description
+; CHECK-UNBALANCED9: invalid pipeline 'no-op-module,)'
; RUN: not opt -disable-output -debug-pass-manager \
; RUN: -passes='no-op-function,)' %s 2>&1 \
; RUN: | FileCheck %s --check-prefix=CHECK-UNBALANCED10
-; CHECK-UNBALANCED10: unable to parse pass pipeline description
+; CHECK-UNBALANCED10: invalid pipeline 'no-op-function,)'
; RUN: opt -disable-output -debug-pass-manager \
; RUN: -passes=no-op-cgscc,no-op-cgscc %s 2>&1 \
@@ -176,37 +176,86 @@
; RUN: not opt -disable-output -debug-pass-manager \
; RUN: -passes='function(no-op-function)function(no-op-function)' %s 2>&1 \
; RUN: | FileCheck %s --check-prefix=CHECK-MISSING-COMMA1
-; CHECK-MISSING-COMMA1: unable to parse pass pipeline description
+; CHECK-MISSING-COMMA1: invalid pipeline 'function(no-op-function)function(no-op-function)'
; RUN: not opt -disable-output -debug-pass-manager \
; RUN: -passes='function()' %s 2>&1 \
; RUN: | FileCheck %s --check-prefix=CHECK-EMPTY-INNER-PIPELINE
-; CHECK-EMPTY-INNER-PIPELINE: unable to parse pass pipeline description
+; CHECK-EMPTY-INNER-PIPELINE: unknown function pass ''
; RUN: not opt -disable-output -debug-pass-manager \
; RUN: -passes='no-op-module(no-op-module,whatever)' %s 2>&1 \
; RUN: | FileCheck %s --check-prefix=CHECK-PIPELINE-ON-MODULE-PASS
-; CHECK-PIPELINE-ON-MODULE-PASS: unable to parse pass pipeline description
+; CHECK-PIPELINE-ON-MODULE-PASS: invalid use of 'no-op-module' pass as module pipeline
; RUN: not opt -disable-output -debug-pass-manager \
; RUN: -passes='no-op-cgscc(no-op-cgscc,whatever)' %s 2>&1 \
; RUN: | FileCheck %s --check-prefix=CHECK-PIPELINE-ON-CGSCC-PASS
-; CHECK-PIPELINE-ON-CGSCC-PASS: unable to parse pass pipeline description
+; CHECK-PIPELINE-ON-CGSCC-PASS: invalid use of 'no-op-cgscc' pass as cgscc pipeline
; RUN: not opt -disable-output -debug-pass-manager \
; RUN: -passes='no-op-function(no-op-function,whatever)' %s 2>&1 \
; RUN: | FileCheck %s --check-prefix=CHECK-PIPELINE-ON-FUNCTION-PASS
-; CHECK-PIPELINE-ON-FUNCTION-PASS: unable to parse pass pipeline description
+; CHECK-PIPELINE-ON-FUNCTION-PASS: invalid use of 'no-op-function' pass as function pipeline
; RUN: not opt -disable-output -debug-pass-manager \
; RUN: -passes='no-op-loop(no-op-loop,whatever)' %s 2>&1 \
; RUN: | FileCheck %s --check-prefix=CHECK-PIPELINE-ON-LOOP-PASS
-; CHECK-PIPELINE-ON-LOOP-PASS: unable to parse pass pipeline description
+; CHECK-PIPELINE-ON-LOOP-PASS: invalid use of 'no-op-loop' pass as loop pipeline
; RUN: not opt -disable-output -debug-pass-manager \
; RUN: -passes='no-op-function()' %s 2>&1 \
; RUN: | FileCheck %s --check-prefix=CHECK-EMPTY-PIPELINE-ON-PASS
-; CHECK-EMPTY-PIPELINE-ON-PASS: unable to parse pass pipeline description
+; CHECK-EMPTY-PIPELINE-ON-PASS: invalid use of 'no-op-function' pass as function pipeline
+
+; RUN: not opt -passes='no-op-module,bad' \
+; RUN: /dev/null -disable-output 2>&1 | FileCheck %s -check-prefix=CHECK-UNKNOWN-MODULE
+; CHECK-UNKNOWN-MODULE: opt: unknown module pass 'bad'
+
+; RUN: not opt -passes='no-op-loop,bad' \
+; RUN: /dev/null -disable-output 2>&1 | FileCheck %s -check-prefix=CHECK-UNKNOWN-LOOP
+; CHECK-UNKNOWN-LOOP: opt: unknown loop pass 'bad'
+
+; RUN: not opt -passes='no-op-cgscc,bad' \
+; RUN: /dev/null -disable-output 2>&1 | FileCheck %s -check-prefix=CHECK-UNKNOWN-CGSCC
+; CHECK-UNKNOWN-CGSCC: opt: unknown cgscc pass 'bad'
+
+; RUN: not opt -passes='no-op-function,bad' \
+; RUN: /dev/null -disable-output 2>&1 | FileCheck %s -check-prefix=CHECK-UNKNOWN-FUNCTION
+; RUN: not opt -passes='function(bad,pipeline,text)' \
+; RUN: /dev/null -disable-output 2>&1 | FileCheck %s -check-prefix=CHECK-UNKNOWN-FUNCTION
+; RUN: not opt -passes='module(no-op-module,function(bad,pipeline,text))' \
+; RUN: /dev/null -disable-output 2>&1 | FileCheck %s -check-prefix=CHECK-UNKNOWN-FUNCTION
+; RUN: not opt -passes='no-op-module,function(bad,pipeline,text)' \
+; RUN: /dev/null -disable-output 2>&1 | FileCheck %s -check-prefix=CHECK-UNKNOWN-FUNCTION
+; RUN: not opt -passes='module(cgscc(function(bad,pipeline,text)))' \
+; RUN: /dev/null -disable-output 2>&1 | FileCheck %s -check-prefix=CHECK-UNKNOWN-FUNCTION
+; CHECK-UNKNOWN-FUNCTION: opt: unknown function pass 'bad'
+
+; RUN: not opt -aa-pipeline=bad -passes=no-op-function \
+; RUN: /dev/null -disable-output 2>&1 | FileCheck %s -check-prefix=AA-PIPELINE-ERR
+; AA-PIPELINE-ERR: unknown alias analysis name 'bad'
+; RUN: opt -passes-ep-peephole=bad -passes=no-op-function \
+; RUN: /dev/null -disable-output 2>&1 | FileCheck %s -check-prefix=PASSES-EP-PEEPHOLE-ERR
+; PASSES-EP-PEEPHOLE-ERR: Could not parse -passes-ep-peephole pipeline: unknown function pass 'bad'
+; RUN: opt -passes-ep-late-loop-optimizations=bad -passes=no-op-function \
+; RUN: /dev/null -disable-output 2>&1 | FileCheck %s -check-prefix=PASSES-EP-LATELOOPOPT-ERR
+; PASSES-EP-LATELOOPOPT-ERR: Could not parse -passes-ep-late-loop-optimizations pipeline: unknown loop pass 'bad'
+; RUN: opt -passes-ep-loop-optimizer-end=bad -passes=no-op-function \
+; RUN: /dev/null -disable-output 2>&1 | FileCheck %s -check-prefix=PASSES-EP-LOOPOPTEND-ERR
+; PASSES-EP-LOOPOPTEND-ERR: Could not parse -passes-ep-loop-optimizer-end pipeline: unknown loop pass 'bad'
+; RUN: opt -passes-ep-scalar-optimizer-late=bad -passes=no-op-function \
+; RUN: /dev/null -disable-output 2>&1 | FileCheck %s -check-prefix=PASSES-EP-SCALAROPTLATE-ERR
+; PASSES-EP-SCALAROPTLATE-ERR: Could not parse -passes-ep-scalar-optimizer-late pipeline: unknown function pass 'bad'
+; RUN: opt -passes-ep-cgscc-optimizer-late=bad -passes=no-op-function \
+; RUN: /dev/null -disable-output 2>&1 | FileCheck %s -check-prefix=PASSES-EP-CGSCCOPTLATE-ERR
+; PASSES-EP-CGSCCOPTLATE-ERR: Could not parse -passes-ep-cgscc-optimizer-late pipeline: unknown cgscc pass 'bad'
+; RUN: opt -passes-ep-vectorizer-start=bad -passes=no-op-function \
+; RUN: /dev/null -disable-output 2>&1 | FileCheck %s -check-prefix=PASSES-EP-VECTORIZERSTART-ERR
+; PASSES-EP-VECTORIZERSTART-ERR: Could not parse -passes-ep-vectorizer-start pipeline: unknown function pass 'bad'
+; RUN: opt -passes-ep-pipeline-start=bad -passes=no-op-function \
+; RUN: /dev/null -disable-output 2>&1 | FileCheck %s -check-prefix=PASSES-EP-PIPELINESTART-ERR
+; PASSES-EP-PIPELINESTART-ERR: Could not parse -passes-ep-pipeline-start pipeline: unknown pass name 'bad'
define void @f() {
entry:
diff --git a/llvm/test/tools/llvm-lto2/X86/pipeline.ll b/llvm/test/tools/llvm-lto2/X86/pipeline.ll
index 29276d8d13a..9ab81ac70a7 100644
--- a/llvm/test/tools/llvm-lto2/X86/pipeline.ll
+++ b/llvm/test/tools/llvm-lto2/X86/pipeline.ll
@@ -32,11 +32,11 @@ define void @patatino() {
; RUN: -r %t1.bc,patatino,px -opt-pipeline foogoo 2>&1 | \
; RUN: FileCheck %s --check-prefix=ERR
-; ERR: LLVM ERROR: unable to parse pass pipeline description: foogoo
+; ERR: LLVM ERROR: unable to parse pass pipeline description 'foogoo': unknown pass name 'foogoo'
; RUN: not llvm-lto2 run %t1.bc -o %t.o \
; RUN: -r %t1.bc,patatino,px -aa-pipeline patatino \
; RUN: -opt-pipeline loweratomic 2>&1 | \
; RUN: FileCheck %s --check-prefix=AAERR
-; AAERR: LLVM ERROR: unable to parse AA pipeline description: patatino
+; AAERR: LLVM ERROR: unable to parse AA pipeline description 'patatino': unknown alias analysis name 'patatino'
diff --git a/llvm/test/tools/llvm-opt-fuzzer/command-line.ll b/llvm/test/tools/llvm-opt-fuzzer/command-line.ll
index f747bba431b..8c3f6b60154 100644
--- a/llvm/test/tools/llvm-opt-fuzzer/command-line.ll
+++ b/llvm/test/tools/llvm-opt-fuzzer/command-line.ll
@@ -13,7 +13,7 @@
; Don't start with incorrect passes specified
; RUN: not llvm-opt-fuzzer %t -ignore_remaining_args=1 -mtriple x86_64 -passes no-pass 2>&1 | FileCheck -check-prefix=PIPELINE %s
-; PIPELINE: can't parse pass pipeline
+; PIPELINE: unknown pass name 'no-pass'
; Correct command line
; RUN: llvm-opt-fuzzer %t -ignore_remaining_args=1 -mtriple x86_64 -passes instcombine 2>&1 | FileCheck -check-prefix=CORRECT %s
OpenPOWER on IntegriCloud