Skip to content

Commit 306ff74

Browse files
committed
[SelectionDAG] Use APInt::zextOrSelf instead of zextOrTrunc in ComputePHILiveOutRegInfo
The width never decreases here.
1 parent 9587118 commit 306ff74

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ void FunctionLoweringInfo::ComputePHILiveOutRegInfo(const PHINode *PN) {
459459
}
460460

461461
if (ConstantInt *CI = dyn_cast<ConstantInt>(V)) {
462-
APInt Val = CI->getValue().zextOrTrunc(BitWidth);
462+
APInt Val = CI->getValue().zextOrSelf(BitWidth);
463463
DestLOI.NumSignBits = Val.getNumSignBits();
464464
DestLOI.Known = KnownBits::makeConstant(Val);
465465
} else {
@@ -491,7 +491,7 @@ void FunctionLoweringInfo::ComputePHILiveOutRegInfo(const PHINode *PN) {
491491
}
492492

493493
if (ConstantInt *CI = dyn_cast<ConstantInt>(V)) {
494-
APInt Val = CI->getValue().zextOrTrunc(BitWidth);
494+
APInt Val = CI->getValue().zextOrSelf(BitWidth);
495495
DestLOI.NumSignBits = std::min(DestLOI.NumSignBits, Val.getNumSignBits());
496496
DestLOI.Known.Zero &= ~Val;
497497
DestLOI.Known.One &= Val;

0 commit comments

Comments
 (0)