xref: /llvm-project/llvm/test/Other/debugcounter-dce.ll (revision d46e37348ec3f8054b10bcbbe7c11149d7f61031)
1; REQUIRES: asserts
2; RUN: opt -passes=dce -S -debug-counter=dce-transform=1-2  < %s | FileCheck %s
3;; Test that, with debug counters on, we will skip the first DCE opportunity, perform next 2,
4;; and ignore all the others left.
5
6; CHECK-LABEL: @test
7; CHECK-NEXT: %add1 = add i32 1, 2
8; CHECK-NEXT: %sub1 = sub i32 %add1, 1
9; CHECK-NEXT: %add2 = add i32 1, 2
10; CHECK-NEXT: %add3 = add i32 1, 2
11; CHECK-NEXT: ret void
12define void @test() {
13  %add1 = add i32 1, 2
14  %sub1 = sub i32 %add1, 1
15  %add2 = add i32 1, 2
16  %sub2 = sub i32 %add2, 1
17  %add3 = add i32 1, 2
18  %sub3 = sub i32 %add3, 1
19  ret void
20}
21