Skip to content

Commit 7513650

Browse files
committed
[ConstantFolding] Remove unnecessary pointer handling in FoldBitCast (NFCI)
The destination element type here cannot be a pointer type, as this would require an inttoptr rather than bitcast.
1 parent df49a97 commit 7513650

File tree

1 file changed

+0
-9
lines changed

1 file changed

+0
-9
lines changed

llvm/lib/Analysis/ConstantFolding.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -277,15 +277,6 @@ Constant *FoldBitCast(Constant *C, Type *DestTy, const DataLayout &DL) {
277277
ConstantInt::get(Src->getType(), ShiftAmt));
278278
ShiftAmt += isLittleEndian ? DstBitSize : -DstBitSize;
279279

280-
// Truncate the element to an integer with the same pointer size and
281-
// convert the element back to a pointer using a inttoptr.
282-
if (DstEltTy->isPointerTy()) {
283-
IntegerType *DstIntTy = Type::getIntNTy(C->getContext(), DstBitSize);
284-
Constant *CE = ConstantExpr::getTrunc(Elt, DstIntTy);
285-
Result.push_back(ConstantExpr::getIntToPtr(CE, DstEltTy));
286-
continue;
287-
}
288-
289280
// Truncate and remember this piece.
290281
Result.push_back(ConstantExpr::getTrunc(Elt, DstEltTy));
291282
}

0 commit comments

Comments
 (0)