1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 10:42:39 +01:00
llvm-mirror/test/Other/debugcounter-earlycse.ll
Bryan Chan a99283db0a [EarlyCSE] Verify hash code in regression tests
As discussed in D86843, -earlycse-debug-hash should be used in more regression
tests to catch inconsistency between the hashing and the equivalence check.

Differential Revision: https://reviews.llvm.org/D86863
2020-09-04 10:40:35 -04:00

28 lines
805 B
LLVM

; REQUIRES: asserts
; RUN: opt -S -debug-counter=early-cse-skip=1,early-cse-count=1 -early-cse -earlycse-debug-hash < %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
}