xref: /llvm-project/llvm/test/Other/opt-bisect-print-ir-path.ll (revision ccc9107ad6858424fcfc1c24f0264f82d351b9eb)
1; RUN: opt -disable-verify -passes=instcombine < %s -opt-bisect-limit=0 -opt-bisect-print-ir-path=%t -disable-output
2; RUN: FileCheck %s --check-prefix=LIMIT0 --input-file %t
3; RUN: opt -disable-verify -passes=instcombine < %s -opt-bisect-limit=1 -opt-bisect-print-ir-path=%t -disable-output
4; RUN: FileCheck %s --check-prefix=LIMIT1 --input-file %t
5; RUN: opt -disable-verify -passes=instcombine < %s -opt-bisect-limit=2 -opt-bisect-print-ir-path=%t -disable-output
6; FIXME: print IR if limit is higher than number of opt-bisect invocations
7
8; Check that we only print the module once
9; RUN: opt -disable-verify -passes=instcombine < %s -opt-bisect-limit=1 -opt-bisect-print-ir-path=- -disable-output 2>&1 | FileCheck %s
10
11; LIMIT0: ret i32 %r
12; LIMIT0: ret i32 %r
13
14; LIMIT1: ret i32 2
15; LIMIT1: ret i32 %r
16
17; CHECK: ModuleID
18; CHECK-NOT: ModuleID
19
20define i32 @f1() {
21  %r = add i32 1, 1
22  ret i32 %r
23}
24
25define i32 @f2() {
26  %r = add i32 1, 1
27  ret i32 %r
28}
29