Skip to content

Commit b901aca

Browse files
committed
[InstCombine] Remove unnecessary typed pointer fold (NFCI)
Pointer bitcasts will be optimized away, no need to fold them for icmps in particular.
1 parent 1f02743 commit b901aca

File tree

1 file changed

+0
-12
lines changed

1 file changed

+0
-12
lines changed

llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3258,18 +3258,6 @@ Instruction *InstCombinerImpl::foldICmpBitCast(ICmpInst &Cmp) {
32583258
}
32593259
}
32603260

3261-
// Test to see if the operands of the icmp are casted versions of other
3262-
// values. If the ptr->ptr cast can be stripped off both arguments, do so.
3263-
if (DstType->isPointerTy() && (isa<Constant>(Op1) || isa<BitCastInst>(Op1))) {
3264-
// If operand #1 is a bitcast instruction, it must also be a ptr->ptr cast
3265-
// so eliminate it as well.
3266-
if (auto *BC2 = dyn_cast<BitCastInst>(Op1))
3267-
Op1 = BC2->getOperand(0);
3268-
3269-
Op1 = Builder.CreateBitCast(Op1, SrcType);
3270-
return new ICmpInst(Pred, BCSrcOp, Op1);
3271-
}
3272-
32733261
const APInt *C;
32743262
if (!match(Cmp.getOperand(1), m_APInt(C)) || !DstType->isIntegerTy() ||
32753263
!SrcType->isIntOrIntVectorTy())

0 commit comments

Comments
 (0)