Skip to content

Commit 9472a81

Browse files
committed
Address post commit review feedback from D137046
It was pointed out the verifier rejects inttoptr and ptrtoint casts with inputs and outputs whose scalability doesn't match. As such, checking the input type separately from the type of the cast itself is redundant.
1 parent 29a500b commit 9472a81

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

llvm/lib/Analysis/ValueTracking.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2565,17 +2565,15 @@ bool isKnownNonZero(const Value *V, const APInt &DemandedElts, unsigned Depth,
25652565
// Note that we have to take special care to avoid looking through
25662566
// truncating casts, e.g., int2ptr/ptr2int with appropriate sizes, as well
25672567
// as casts that can alter the value, e.g., AddrSpaceCasts.
2568-
if (!isa<ScalableVectorType>(I->getOperand(0)->getType()) &&
2569-
!isa<ScalableVectorType>(I->getType()) &&
2568+
if (!isa<ScalableVectorType>(I->getType()) &&
25702569
Q.DL.getTypeSizeInBits(I->getOperand(0)->getType()).getFixedSize() <=
25712570
Q.DL.getTypeSizeInBits(I->getType()).getFixedSize())
25722571
return isKnownNonZero(I->getOperand(0), Depth, Q);
25732572
break;
25742573
case Instruction::PtrToInt:
25752574
// Similar to int2ptr above, we can look through ptr2int here if the cast
25762575
// is a no-op or an extend and not a truncate.
2577-
if (!isa<ScalableVectorType>(I->getOperand(0)->getType()) &&
2578-
!isa<ScalableVectorType>(I->getType()) &&
2576+
if (!isa<ScalableVectorType>(I->getType()) &&
25792577
Q.DL.getTypeSizeInBits(I->getOperand(0)->getType()).getFixedSize() <=
25802578
Q.DL.getTypeSizeInBits(I->getType()).getFixedSize())
25812579
return isKnownNonZero(I->getOperand(0), Depth, Q);

0 commit comments

Comments
 (0)