1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 19:23:23 +01:00
llvm-mirror/test/Transforms/InstCombine/expensive-combines.ll
Nikita Popov 963471fb57 [InstCombine] Support disabling expensive combines in opt
Currently, there is no way to disable ExpensiveCombines when doing
a standalone opt -instcombine run, as that's the default, and the
opt option can currently only be used to force enable, not to force
disable. The only way to disable expensive combines is via -O1 or -O2,
but that of course also runs the rest of the kitchen sink...

This patch allows using opt -instcombine -expensive-combines=0 to
run InstCombine without ExpensiveCombines.

Differential Revision: https://reviews.llvm.org/D72861
2020-01-17 17:56:20 +01:00

29 lines
1020 B
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -S -instcombine < %s | FileCheck %s --check-prefix=DEFAULT
; RUN: opt -S -instcombine -expensive-combines=1 < %s | FileCheck %s --check-prefix=EXPENSIVE-ON
; RUN: opt -S -instcombine -expensive-combines=0 < %s | FileCheck %s --check-prefix=EXPENSIVE-OFF
define void @test() {
; DEFAULT-LABEL: @test(
; DEFAULT-NEXT: [[CALL:%.*]] = call i32 @passthru(i32 0)
; DEFAULT-NEXT: call void @sink(i32 0)
; DEFAULT-NEXT: ret void
;
; EXPENSIVE-ON-LABEL: @test(
; EXPENSIVE-ON-NEXT: [[CALL:%.*]] = call i32 @passthru(i32 0)
; EXPENSIVE-ON-NEXT: call void @sink(i32 0)
; EXPENSIVE-ON-NEXT: ret void
;
; EXPENSIVE-OFF-LABEL: @test(
; EXPENSIVE-OFF-NEXT: [[CALL:%.*]] = call i32 @passthru(i32 0)
; EXPENSIVE-OFF-NEXT: call void @sink(i32 [[CALL]])
; EXPENSIVE-OFF-NEXT: ret void
;
%call = call i32 @passthru(i32 0)
call void @sink(i32 %call)
ret void
}
declare i32 @passthru(i32 returned)
declare void @sink(i32)