summaryrefslogtreecommitdiff
path: root/test/Other
diff options
context:
space:
mode:
authorDiego Novillo <dnovillo@google.com>2014-04-08 16:42:38 +0000
committerDiego Novillo <dnovillo@google.com>2014-04-08 16:42:38 +0000
commit35d647b6f371265519df465ad1e7b28de7515185 (patch)
treead63e722df8f390fd5ad581e07aebba71c5bb7e9 /test/Other
parentccbf1d2a05a63f18bedbeddffe930cc70d5f5823 (diff)
downloadllvm-35d647b6f371265519df465ad1e7b28de7515185.tar.gz
llvm-35d647b6f371265519df465ad1e7b28de7515185.tar.bz2
llvm-35d647b6f371265519df465ad1e7b28de7515185.tar.xz
Add -pass-remarks flag to 'opt'.
Summary: This adds support in 'opt' to filter pass remarks emitted by optimization passes. A new flag -pass-remarks specifies which passes should emit a diagnostic when LLVMContext::emitOptimizationRemark is invoked. This will allow the front end to simply pass along the regular expression from its own -Rpass flag when launching the backend. Depends on D3227. Reviewers: qcolombet CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D3291 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205775 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Other')
-rw-r--r--test/Other/optimization-remarks-inline.ll33
1 files changed, 33 insertions, 0 deletions
diff --git a/test/Other/optimization-remarks-inline.ll b/test/Other/optimization-remarks-inline.ll
new file mode 100644
index 0000000000..4870c17ae2
--- /dev/null
+++ b/test/Other/optimization-remarks-inline.ll
@@ -0,0 +1,33 @@
+; RUN: opt < %s -inline -pass-remarks='inline' -S 2>&1 | FileCheck %s
+; RUN: opt < %s -inline -pass-remarks='inl.*' -S 2>&1 | FileCheck %s
+; RUN: opt < %s -inline -pass-remarks='vector' -pass-remarks='inl' -S 2>&1 | FileCheck %s
+; RUN: opt < %s -inline -pass-remarks='vector' -S 2>&1 | FileCheck --check-prefix=REMARKS %s
+; RUN: opt < %s -inline -S 2>&1 | FileCheck --check-prefix=REMARKS %s
+; RUN: not opt < %s -pass-remarks='(' 2>&1 | FileCheck --check-prefix=BAD-REGEXP %s
+
+define i32 @foo(i32 %x, i32 %y) #0 {
+entry:
+ %x.addr = alloca i32, align 4
+ %y.addr = alloca i32, align 4
+ store i32 %x, i32* %x.addr, align 4
+ store i32 %y, i32* %y.addr, align 4
+ %0 = load i32* %x.addr, align 4
+ %1 = load i32* %y.addr, align 4
+ %add = add nsw i32 %0, %1
+ ret i32 %add
+}
+
+define i32 @bar(i32 %j) #0 {
+entry:
+ %j.addr = alloca i32, align 4
+ store i32 %j, i32* %j.addr, align 4
+ %0 = load i32* %j.addr, align 4
+ %1 = load i32* %j.addr, align 4
+ %sub = sub nsw i32 %1, 2
+ %call = call i32 @foo(i32 %0, i32 %sub)
+; CHECK: foo inlined into bar
+; REMARKS-NOT: foo inlined into bar
+ ret i32 %call
+}
+
+; BAD-REGEXP: Invalid regular expression '(' in -pass-remarks: