[llvm] 3a39346 - [InstCombine] Remove unnecessary typed pointer handling (NFC)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 25 01:35:00 PDT 2023
Author: Nikita Popov
Date: 2023-10-25T10:34:39+02:00
New Revision: 3a39346a06adfae1e2e0bbd1ebc36beb4fe97a42
URL: https://github.com/llvm/llvm-project/commit/3a39346a06adfae1e2e0bbd1ebc36beb4fe97a42
DIFF: https://github.com/llvm/llvm-project/commit/3a39346a06adfae1e2e0bbd1ebc36beb4fe97a42.diff
LOG: [InstCombine] Remove unnecessary typed pointer handling (NFC)
Added:
Modified:
llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
index f39bfc655bf9cf5..5137734b63b3b72 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
@@ -5689,13 +5689,8 @@ Instruction *InstCombinerImpl::foldICmpWithCastOp(ICmpInst &ICmp) {
Value *NewOp1 = nullptr;
if (auto *PtrToIntOp1 = dyn_cast<PtrToIntOperator>(ICmp.getOperand(1))) {
Value *PtrSrc = PtrToIntOp1->getOperand(0);
- if (PtrSrc->getType()->getPointerAddressSpace() ==
- Op0Src->getType()->getPointerAddressSpace()) {
+ if (PtrSrc->getType() == Op0Src->getType())
NewOp1 = PtrToIntOp1->getOperand(0);
- // If the pointer types don't match, insert a bitcast.
- if (Op0Src->getType() != NewOp1->getType())
- NewOp1 = Builder.CreateBitCast(NewOp1, Op0Src->getType());
- }
} else if (auto *RHSC = dyn_cast<Constant>(ICmp.getOperand(1))) {
NewOp1 = ConstantExpr::getIntToPtr(RHSC, SrcTy);
}
More information about the llvm-commits
mailing list