1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00
llvm-mirror/test/Transforms/SCCP/phis.ll
Florian Hahn e306a84b0e [SCCP] Use constant ranges for PHI nodes.
For PHIs with multiple incoming values, we can improve precision by
using constant ranges for integers. We can over-approximate phis
by merging the incoming values.

Reviewers: davide, efriedma, mssimpso

Reviewed By: efriedma

Differential Revision: https://reviews.llvm.org/D71933
2020-03-19 12:45:33 +00:00

82 lines
1.6 KiB
LLVM

; RUN: opt < %s -sccp -S | FileCheck %s
define i1 @float.1(i1 %cmp) {
; CHECK-LABEL: define i1 @float.1(i1 %cmp) {
; CHECK-LABEL: end:
; CHECK-NEXT: ret i1 true
;
entry:
br i1 %cmp, label %if.true, label %end
if.true:
br label %end
end:
%p = phi float [ 1.0, %entry ], [ 1.0, %if.true]
%c = fcmp ueq float %p, 1.0
ret i1 %c
}
define i1 @float.2(i1 %cmp) {
; CHECK-LABEL: define i1 @float.2(i1 %cmp) {
; CHECK-LABEL: end:
; CHECK-NEXT: %p = phi float [ 1.000000e+00, %entry ], [ 2.000000e+00, %if.true ]
; CHECK-NEXT: %c = fcmp ueq float %p, 1.000000e+00
; CHECK-NEXT: ret i1 %c
;
entry:
br i1 %cmp, label %if.true, label %end
if.true:
br label %end
end:
%p = phi float [ 1.0, %entry ], [ 2.0, %if.true]
%c = fcmp ueq float %p, 1.0
ret i1 %c
}
define i1 @float.3(float %f, i1 %cmp) {
; CHECK-LABEL: define i1 @float.3(float %f, i1 %cmp)
; CHECK-LABEL: end:
; CHECK-NEXT: %p = phi float [ 1.000000e+00, %entry ], [ %f, %if.true ]
; CHECK-NEXT: %c = fcmp ueq float %p, 1.000000e+00
; CHECK-NEXT: ret i1 %c
;
entry:
br i1 %cmp, label %if.true, label %end
if.true:
br label %end
end:
%p = phi float [ 1.0, %entry ], [ %f, %if.true]
%c = fcmp ueq float %p, 1.0
ret i1 %c
}
define i1 @float.4_unreachable(float %f, i1 %cmp) {
; CHECK-LABEL: define i1 @float.4_unreachable(float %f, i1 %cmp)
; CHECK-LABEL: end:
; CHECK-NEXT: ret i1 false
;
entry:
br i1 %cmp, label %if.true, label %end
if.true:
br label %end
dead:
br label %end
end:
%p = phi float [ 1.0, %entry ], [ 1.0, %if.true], [ %f, %dead ]
%c = fcmp une float %p, 1.0
ret i1 %c
}