[llvm] b901aca - [InstCombine] Remove unnecessary typed pointer fold (NFCI)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 24 07:43:30 PDT 2023
Author: Nikita Popov
Date: 2023-10-24T16:43:22+02:00
New Revision: b901acad541ad44511ba7ba394ab736376e01113
URL: https://github.com/llvm/llvm-project/commit/b901acad541ad44511ba7ba394ab736376e01113
DIFF: https://github.com/llvm/llvm-project/commit/b901acad541ad44511ba7ba394ab736376e01113.diff
LOG: [InstCombine] Remove unnecessary typed pointer fold (NFCI)
Pointer bitcasts will be optimized away, no need to fold them for
icmps in particular.
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 66e2b6c72cce46c..5e16afa32e56beb 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
@@ -3258,18 +3258,6 @@ Instruction *InstCombinerImpl::foldICmpBitCast(ICmpInst &Cmp) {
}
}
- // Test to see if the operands of the icmp are casted versions of other
- // values. If the ptr->ptr cast can be stripped off both arguments, do so.
- if (DstType->isPointerTy() && (isa<Constant>(Op1) || isa<BitCastInst>(Op1))) {
- // If operand #1 is a bitcast instruction, it must also be a ptr->ptr cast
- // so eliminate it as well.
- if (auto *BC2 = dyn_cast<BitCastInst>(Op1))
- Op1 = BC2->getOperand(0);
-
- Op1 = Builder.CreateBitCast(Op1, SrcType);
- return new ICmpInst(Pred, BCSrcOp, Op1);
- }
-
const APInt *C;
if (!match(Cmp.getOperand(1), m_APInt(C)) || !DstType->isIntegerTy() ||
!SrcType->isIntOrIntVectorTy())
More information about the llvm-commits
mailing list