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
62 lines
1.8 KiB
LLVM
62 lines
1.8 KiB
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 @read_dmatrix() #0 {
|
|
; CHECK-LABEL: @read_dmatrix(
|
|
; CHECK-NEXT: entry:
|
|
; CHECK-NEXT: [[HEIGHT:%.*]] = alloca i32, align 4
|
|
; CHECK-NEXT: br label [[FOR_COND:%.*]]
|
|
; CHECK: for.cond:
|
|
; CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* [[HEIGHT]], align 4
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 0, [[TMP0]]
|
|
; CHECK-NEXT: br i1 [[CMP]], label [[FOR_COND6:%.*]], label [[FOR_END16:%.*]]
|
|
; CHECK: for.cond6:
|
|
; CHECK-NEXT: br label [[FOR_COND]]
|
|
; CHECK: for.end16:
|
|
; CHECK-NEXT: ret void
|
|
;
|
|
entry:
|
|
%height = alloca i32, align 4
|
|
br label %for.cond
|
|
|
|
for.cond: ; preds = %for.cond6, %entry
|
|
%j.0 = phi i32 [ undef, %entry ], [ 0, %for.cond6 ]
|
|
%0 = load i32, i32* %height, align 4
|
|
%cmp = icmp slt i32 0, %0
|
|
br i1 %cmp, label %for.cond6, label %for.end16
|
|
|
|
for.cond6: ; preds = %for.cond
|
|
br label %for.cond
|
|
|
|
for.end16: ; preds = %for.cond
|
|
%sub21 = sub nsw i32 %j.0, 1
|
|
ret void
|
|
}
|
|
|
|
declare i1 @cond()
|
|
|
|
define void @emptyTT() #0 {
|
|
; CHECK-LABEL: @emptyTT(
|
|
; CHECK-NEXT: entry:
|
|
; CHECK-NEXT: br label [[FOR_COND:%.*]]
|
|
; CHECK: for.cond:
|
|
; CHECK-NEXT: [[C:%.*]] = call i1 @cond()
|
|
; CHECK-NEXT: br i1 [[C]], label [[FOR_COND]], label [[EXIT:%.*]]
|
|
; CHECK: exit:
|
|
; CHECK-NEXT: ret void
|
|
;
|
|
entry:
|
|
br label %for.cond
|
|
|
|
for.cond: ; preds = %for.cond, %entry
|
|
%.compoundliteral.sroa.0.0 = phi i64 [ undef, %entry ], [ 0, %for.cond ]
|
|
%bf.clear = and i64 %.compoundliteral.sroa.0.0, -67108864
|
|
%c = call i1 @cond()
|
|
br i1 %c, label %for.cond, label %exit
|
|
|
|
exit:
|
|
ret void
|
|
}
|