Skip to content

Commit d65ef43

Browse files
nikiczmodem
authored andcommitted
[InstCombine] Add test for -expensive-combines option; NFC
This shows that -expensive-combines=0 is ignored. (cherry picked from commit 2d0d423)
1 parent 9db3e5d commit d65ef43

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2+
; RUN: opt -S -instcombine < %s | FileCheck %s --check-prefix=DEFAULT
3+
; RUN: opt -S -instcombine -expensive-combines=1 < %s | FileCheck %s --check-prefix=EXPENSIVE-ON
4+
; RUN: opt -S -instcombine -expensive-combines=0 < %s | FileCheck %s --check-prefix=EXPENSIVE-OFF
5+
6+
define void @test() {
7+
; DEFAULT-LABEL: @test(
8+
; DEFAULT-NEXT: [[CALL:%.*]] = call i32 @passthru(i32 0)
9+
; DEFAULT-NEXT: call void @sink(i32 0)
10+
; DEFAULT-NEXT: ret void
11+
;
12+
; EXPENSIVE-ON-LABEL: @test(
13+
; EXPENSIVE-ON-NEXT: [[CALL:%.*]] = call i32 @passthru(i32 0)
14+
; EXPENSIVE-ON-NEXT: call void @sink(i32 0)
15+
; EXPENSIVE-ON-NEXT: ret void
16+
;
17+
; EXPENSIVE-OFF-LABEL: @test(
18+
; EXPENSIVE-OFF-NEXT: [[CALL:%.*]] = call i32 @passthru(i32 0)
19+
; EXPENSIVE-OFF-NEXT: call void @sink(i32 0)
20+
; EXPENSIVE-OFF-NEXT: ret void
21+
;
22+
%call = call i32 @passthru(i32 0)
23+
call void @sink(i32 %call)
24+
ret void
25+
}
26+
27+
declare i32 @passthru(i32 returned)
28+
declare void @sink(i32)

0 commit comments

Comments
 (0)