expensive-combines.ll 1020 Bytes
; 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)