Skip to content

Commit d75a408

Browse files
committed
fixup! [LVI] Support no constant range of cast and freeze value in getEdgeValueLocal.
1 parent 7cce3e7 commit d75a408

File tree

2 files changed

+2
-26
lines changed

2 files changed

+2
-26
lines changed

llvm/lib/Analysis/LazyValueInfo.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1493,12 +1493,12 @@ LazyValueInfoImpl::getEdgeValueLocal(Value *Val, BasicBlock *BBFrom,
14931493
// br %Condition, label %then, label %else
14941494
APInt ConditionVal(1, isTrueDest ? 1 : 0);
14951495
Result = constantFoldUser(Usr, Condition, ConditionVal, DL);
1496-
} else if (isa<TruncInst, ZExtInst, SExtInst, FreezeInst>(Usr)) {
1496+
} else if (isa<TruncInst, ZExtInst, SExtInst>(Usr)) {
14971497
ValueLatticeElement OpLatticeVal =
14981498
*getValueFromCondition(Usr->getOperand(0), Condition,
14991499
isTrueDest, /*UseBlockValue*/ false);
15001500

1501-
if (isa<FreezeInst>(Usr) || !OpLatticeVal.isConstantRange())
1501+
if (!OpLatticeVal.isConstantRange())
15021502
return OpLatticeVal;
15031503

15041504
const unsigned ResultBitWidth =

llvm/test/Transforms/CorrelatedValuePropagation/range.ll

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1355,30 +1355,6 @@ target:
13551355
ret i8 %b
13561356
}
13571357

1358-
define i8 @return_range_for_edge_value_freeze(i8 %a) {
1359-
; CHECK-LABEL: define range(i8 0, 98) i8 @return_range_for_edge_value_freeze(
1360-
; CHECK-SAME: i8 [[A:%.*]]) {
1361-
; CHECK-NEXT: [[ENTRY:.*:]]
1362-
; CHECK-NEXT: [[B:%.*]] = freeze i8 [[A]]
1363-
; CHECK-NEXT: br label %[[DISPATCH:.*]]
1364-
; CHECK: [[DISPATCH]]:
1365-
; CHECK-NEXT: [[CMP:%.*]] = icmp ult i8 [[A]], 98
1366-
; CHECK-NEXT: br i1 [[CMP]], label %[[TARGET:.*]], label %[[DISPATCH]]
1367-
; CHECK: [[TARGET]]:
1368-
; CHECK-NEXT: ret i8 [[B]]
1369-
;
1370-
entry:
1371-
%b = freeze i8 %a
1372-
br label %dispatch
1373-
1374-
dispatch:
1375-
%cmp = icmp ult i8 %a, 98
1376-
br i1 %cmp, label %target, label %dispatch
1377-
1378-
target:
1379-
ret i8 %b
1380-
}
1381-
13821358
declare i16 @llvm.ctlz.i16(i16, i1)
13831359
declare i16 @llvm.cttz.i16(i16, i1)
13841360
declare i16 @llvm.ctpop.i16(i16)

0 commit comments

Comments
 (0)