mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-01 12:24:24 +00:00
Bitcasts are transitive. Bitcast-Bitcast-X becomes Bitcast-X.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@138722 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -1659,6 +1659,11 @@ Instruction *InstCombiner::visitBitCast(BitCastInst &CI) {
|
||||
if (DestTy == Src->getType())
|
||||
return ReplaceInstUsesWith(CI, Src);
|
||||
|
||||
// Bitcasts are transitive.
|
||||
if (BitCastInst* BSrc = dyn_cast<BitCastInst>(Src)) {
|
||||
return CastInst::Create(Instruction::BitCast, BSrc->getOperand(0), DestTy);
|
||||
}
|
||||
|
||||
if (PointerType *DstPTy = dyn_cast<PointerType>(DestTy)) {
|
||||
PointerType *SrcPTy = cast<PointerType>(SrcTy);
|
||||
Type *DstElTy = DstPTy->getElementType();
|
||||
|
Reference in New Issue
Block a user