diff options
author | Zhizhou Yang <zhizhouyang@gmail.com> | 2018-10-23 21:51:56 +0000 |
---|---|---|
committer | Zhizhou Yang <zhizhouyang@gmail.com> | 2018-10-23 21:51:56 +0000 |
commit | 13f76f84bc8f6a0bad31f56639a12f43f938b0b9 (patch) | |
tree | d90f240f285ff923829f659ae7c9e89234a7fd71 /llvm/test/Other/print-debug-counter.ll | |
parent | 3ef53e10d3a6bdefdf6e0974775ca0edafc5a91d (diff) |
Print out DebugCounter info with -print-debug-counter
Summary:
This patch will print out {Counter, Skip, StopAfter} info of all passes which have DebugCounter set at destruction.
It can be used to monitor how many times does certain transformation happen in a pass, and also help check if -debug-counter option is set correctly.
Please refer to this [[ http://lists.llvm.org/pipermail/llvm-dev/2018-July/124722.html | thread ]] for motivation.
Reviewers: george.burgess.iv, davide, greened
Reviewed By: greened
Subscribers: kristina, llozano, mgorny, llvm-commits, mgrang
Differential Revision: https://reviews.llvm.org/D50031
llvm-svn: 345085
Diffstat (limited to 'llvm/test/Other/print-debug-counter.ll')
-rw-r--r-- | llvm/test/Other/print-debug-counter.ll | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/llvm/test/Other/print-debug-counter.ll b/llvm/test/Other/print-debug-counter.ll new file mode 100644 index 000000000000..ffd197197d85 --- /dev/null +++ b/llvm/test/Other/print-debug-counter.ll @@ -0,0 +1,30 @@ +; RUN: opt -S -debug-counter=early-cse-skip=1,early-cse-count=1 -early-cse \ +; RUN: -debug-counter=newgvn-vn-skip=1,newgvn-vn-count=2 -newgvn \ +; RUN: -instcombine -print-debug-counter < %s 2>&1 | FileCheck %s +;; Test debug counter prints correct info in right order. +; CHECK-LABEL: Counters and values: +; CHECK: early-cse +; CHECK-SAME: {4,1,1} +; CHECK: instcombine-visit +; CHECK-SAME: {12,0,-1} +; CHECK: newgvn-vn +; CHECK-SAME: {9,1,2} +define i32 @f1(i32 %a, i32 %b) { +bb: + %add1 = add i32 %a, %b + %add2 = add i32 %a, %b + %add3 = add i32 %a, %b + %add4 = add i32 %a, %b + %ret1 = add i32 %add1, %add2 + %ret2 = add i32 %add3, %add4 + %ret = add i32 %ret1, %ret2 + ret i32 %ret +} + +define i32 @f2(i32 %a, i32 %b) { +bb: + %add1 = add i32 %a, %b + %add2 = add i32 %a, %b + %ret = add i32 %add1, %add2 + ret i32 %ret +} |