Skip to content

Commit c295d74

Browse files
committed
[ConstantFold] Remove unnecessary checks in FoldBitCast() (NFCI)
These are no-op casts, which are already handled earlier.
1 parent 2182561 commit c295d74

File tree

1 file changed

+0
-10
lines changed

1 file changed

+0
-10
lines changed

llvm/lib/IR/ConstantFold.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -83,18 +83,8 @@ static Constant *FoldBitCast(Constant *V, Type *DestTy) {
8383
return nullptr;
8484
}
8585

86-
// Finally, implement bitcast folding now. The code below doesn't handle
87-
// bitcast right.
88-
if (isa<ConstantPointerNull>(V)) // ptr->ptr cast.
89-
return ConstantPointerNull::get(cast<PointerType>(DestTy));
90-
9186
// Handle integral constant input.
9287
if (ConstantInt *CI = dyn_cast<ConstantInt>(V)) {
93-
if (DestTy->isIntegerTy())
94-
// Integral -> Integral. This is a no-op because the bit widths must
95-
// be the same. Consequently, we just fold to V.
96-
return V;
97-
9888
// See note below regarding the PPC_FP128 restriction.
9989
if (DestTy->isFloatingPointTy() && !DestTy->isPPC_FP128Ty())
10090
return ConstantFP::get(DestTy->getContext(),

0 commit comments

Comments
 (0)