Skip to content

Commit d0d8359

Browse files
authored
[InstSimplify] Remove redundant icmp+ptrtoint fold (#171807)
There is a generic fold for recursively calling simplifyICmpInst with the ptrtoint cast stripped: https://github.com/llvm/llvm-project/blob/9b6b52b534ba592d7d6b5863e3d9a240119a74d9/llvm/lib/Analysis/InstructionSimplify.cpp#L3850-L3867 As such, we shouldn't have to explicitly do this for the computePointerICmp() fold. This is not strictly NFC because the recursion limit applies to the generic fold, though I wouldn't expect this to matter in practice.
1 parent 294fb60 commit d0d8359

File tree

1 file changed

+0
-8
lines changed

1 file changed

+0
-8
lines changed

llvm/lib/Analysis/InstructionSimplify.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4077,14 +4077,6 @@ static Value *simplifyICmpInst(CmpPredicate Pred, Value *LHS, Value *RHS,
40774077
if (LHS->getType()->isPointerTy())
40784078
if (auto *C = computePointerICmp(Pred, LHS, RHS, Q))
40794079
return C;
4080-
if (auto *CLHS = dyn_cast<PtrToIntOperator>(LHS))
4081-
if (auto *CRHS = dyn_cast<PtrToIntOperator>(RHS))
4082-
if (CLHS->getPointerOperandType() == CRHS->getPointerOperandType() &&
4083-
Q.DL.getTypeSizeInBits(CLHS->getPointerOperandType()) ==
4084-
Q.DL.getTypeSizeInBits(CLHS->getType()))
4085-
if (auto *C = computePointerICmp(Pred, CLHS->getPointerOperand(),
4086-
CRHS->getPointerOperand(), Q))
4087-
return C;
40884080

40894081
// If the comparison is with the result of a select instruction, check whether
40904082
// comparing with either branch of the select always yields the same value.

0 commit comments

Comments
 (0)