[llvm] 9472a81 - Address post commit review feedback from D137046
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 1 13:36:37 PDT 2022
Author: Philip Reames
Date: 2022-11-01T13:36:13-07:00
New Revision: 9472a810ed33bc9e655484f43047eed07d50bc16
URL: https://github.com/llvm/llvm-project/commit/9472a810ed33bc9e655484f43047eed07d50bc16
DIFF: https://github.com/llvm/llvm-project/commit/9472a810ed33bc9e655484f43047eed07d50bc16.diff
LOG: 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.
Added:
Modified:
llvm/lib/Analysis/ValueTracking.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index be009501f2e9..465678d08fc5 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -2565,8 +2565,7 @@ bool isKnownNonZero(const Value *V, const APInt &DemandedElts, unsigned Depth,
// Note that we have to take special care to avoid looking through
// truncating casts, e.g., int2ptr/ptr2int with appropriate sizes, as well
// as casts that can alter the value, e.g., AddrSpaceCasts.
- if (!isa<ScalableVectorType>(I->getOperand(0)->getType()) &&
- !isa<ScalableVectorType>(I->getType()) &&
+ if (!isa<ScalableVectorType>(I->getType()) &&
Q.DL.getTypeSizeInBits(I->getOperand(0)->getType()).getFixedSize() <=
Q.DL.getTypeSizeInBits(I->getType()).getFixedSize())
return isKnownNonZero(I->getOperand(0), Depth, Q);
@@ -2574,8 +2573,7 @@ bool isKnownNonZero(const Value *V, const APInt &DemandedElts, unsigned Depth,
case Instruction::PtrToInt:
// Similar to int2ptr above, we can look through ptr2int here if the cast
// is a no-op or an extend and not a truncate.
- if (!isa<ScalableVectorType>(I->getOperand(0)->getType()) &&
- !isa<ScalableVectorType>(I->getType()) &&
+ if (!isa<ScalableVectorType>(I->getType()) &&
Q.DL.getTypeSizeInBits(I->getOperand(0)->getType()).getFixedSize() <=
Q.DL.getTypeSizeInBits(I->getType()).getFixedSize())
return isKnownNonZero(I->getOperand(0), Depth, Q);
More information about the llvm-commits
mailing list