1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 04:02:41 +01:00
llvm-mirror/test/Other/debugcounter-earlycse.ll
Geoff Berry 18fcd57acc [EarlyCSE] Add debug counter for debugging mis-optimizations. NFC.
Reviewers: reames, spatel, davide, dberlin

Subscribers: mcrosier, llvm-commits

Differential Revision: https://reviews.llvm.org/D45162

llvm-svn: 329443
2018-04-06 18:47:33 +00:00

28 lines
785 B
LLVM

; REQUIRES: asserts
; RUN: opt -S -debug-counter=early-cse-skip=1,early-cse-count=1 -early-cse < %s 2>&1 | FileCheck %s
;; Test that, with debug counters on, we only optimize the second CSE opportunity.
define i32 @test(i32 %a, i32 %b) {
; CHECK-LABEL: @test(
; CHECK-NEXT: bb:
; CHECK-NEXT: %add1 = add i32 %a, %b
; CHECK-NEXT: %add2 = add i32 %a, %b
; CHECK-NEXT: %add4 = add i32 %a, %b
; CHECK-NEXT: %ret1 = add i32 %add1, %add2
; CHECK-NEXT: %ret2 = add i32 %add1, %add4
; CHECK-NEXT: %ret = add i32 %ret1, %ret2
; CHECK-NEXT: ret i32 %ret
;
bb:
%add1 = add i32 %a, %b
%add2 = add i32 %a, %b
%add3 = add i32 %a, %b
%add4 = add i32 %a, %b
%ret1 = add i32 %add1, %add2
%ret2 = add i32 %add3, %add4
%ret = add i32 %ret1, %ret2
ret i32 %ret
}