1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-26 12:43:36 +01:00
llvm-mirror/test/Transforms/SCCP/float-phis.ll
Florian Hahn 4271526a2f [ValueLattice] Add new state for undef constants.
This patch adds a new undef lattice state, which is used to represent
UndefValue constants or instructions producing undef.

The main difference to the unknown state is that merging undef values
with constants (or single element constant ranges) produces  the
constant/constant range, assuming all uses of the merge result will be
replaced by the found constant.

Contrary, merging non-single element ranges with undef needs to go to
overdefined. Using unknown for UndefValues currently causes mis-compiles
in CVP/LVI (PR44949) and will become problematic once we use
ValueLatticeElement for SCCP.

Reviewers: efriedma, reames, davide, nikic

Reviewed By: efriedma

Differential Revision: https://reviews.llvm.org/D75120
2020-03-14 17:19:59 +00:00

27 lines
836 B
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -sccp -S | FileCheck %s
declare void @use(i1)
define void @test(i1 %c) {
; CHECK-LABEL: @test(
; CHECK-NEXT: br label [[DO_BODY:%.*]]
; CHECK: do.body:
; CHECK-NEXT: br i1 [[C:%.*]], label [[DO_BODY]], label [[FOR_COND41:%.*]]
; CHECK: for.cond41:
; CHECK-NEXT: call void @use(i1 true)
; CHECK-NEXT: br label [[FOR_COND41]]
;
br label %do.body
do.body: ; preds = %do.body, %entry
br i1 %c, label %do.body, label %for.cond41
for.cond41: ; preds = %for.cond41, %do.body
%mid.0 = phi float [ 0.000000e+00, %for.cond41 ], [ undef, %do.body ]
%fc = fcmp oeq float %mid.0, 0.000000e+00
call void @use(i1 %fc)
br label %for.cond41
}