Skip to content

Commit d0cd71c

Browse files
committed
[LVI][CVP] Treat undef like a full range
1 parent c6573e3 commit d0cd71c

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

llvm/lib/Analysis/LazyValueInfo.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -801,7 +801,7 @@ void LazyValueInfoImpl::intersectAssumeOrGuardBlockValueConstantRange(
801801

802802
static ConstantRange getConstantRangeOrFull(const ValueLatticeElement &Val,
803803
Type *Ty, const DataLayout &DL) {
804-
if (Val.isConstantRange())
804+
if (Val.isConstantRange(/*UndefAllowed*/ false))
805805
return Val.getConstantRange();
806806
return ConstantRange::getFull(DL.getTypeSizeInBits(Ty));
807807
}

llvm/test/Transforms/CorrelatedValuePropagation/merge-range-and-undef.ll

+2-1
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,8 @@ define i32 @constant_range_and_undef_and(i1 %c0, i1 %c1, i8 %v1, i8 %v2) {
398398
; CHECK: bb2:
399399
; CHECK-NEXT: [[V2_I32:%.*]] = zext i8 [[V2:%.*]] to i32
400400
; CHECK-NEXT: [[Y:%.*]] = or i32 [[X]], [[V2_I32]]
401-
; CHECK-NEXT: ret i32 [[Y]]
401+
; CHECK-NEXT: [[Z:%.*]] = and i32 [[Y]], 255
402+
; CHECK-NEXT: ret i32 [[Z]]
402403
;
403404
start:
404405
br i1 %c0, label %bb0, label %bb1

0 commit comments

Comments
 (0)