mirror of
https://github.com/RPCS3/llvm.git
synced 2025-01-01 09:18:30 +00:00
Utilize CastInst::CreatePointerBitCastOrAddrSpaceCast here.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213189 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
ec7a144603
commit
d6b31659a7
@ -1582,9 +1582,8 @@ Instruction *InstCombiner::visitGetElementPtrInst(GetElementPtrInst &GEP) {
|
|||||||
Builder->CreateGEP(StrippedPtr, Idx, GEP.getName());
|
Builder->CreateGEP(StrippedPtr, Idx, GEP.getName());
|
||||||
|
|
||||||
// V and GEP are both pointer types --> BitCast
|
// V and GEP are both pointer types --> BitCast
|
||||||
if (StrippedPtrTy->getAddressSpace() == GEP.getPointerAddressSpace())
|
return CastInst::CreatePointerBitCastOrAddrSpaceCast(NewGEP,
|
||||||
return new BitCastInst(NewGEP, GEP.getType());
|
GEP.getType());
|
||||||
return new AddrSpaceCastInst(NewGEP, GEP.getType());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transform things like:
|
// Transform things like:
|
||||||
@ -1616,9 +1615,8 @@ Instruction *InstCombiner::visitGetElementPtrInst(GetElementPtrInst &GEP) {
|
|||||||
Builder->CreateGEP(StrippedPtr, NewIdx, GEP.getName());
|
Builder->CreateGEP(StrippedPtr, NewIdx, GEP.getName());
|
||||||
|
|
||||||
// The NewGEP must be pointer typed, so must the old one -> BitCast
|
// The NewGEP must be pointer typed, so must the old one -> BitCast
|
||||||
if (StrippedPtrTy->getAddressSpace() == GEP.getPointerAddressSpace())
|
return CastInst::CreatePointerBitCastOrAddrSpaceCast(NewGEP,
|
||||||
return new BitCastInst(NewGEP, GEP.getType());
|
GEP.getType());
|
||||||
return new AddrSpaceCastInst(NewGEP, GEP.getType());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1658,9 +1656,8 @@ Instruction *InstCombiner::visitGetElementPtrInst(GetElementPtrInst &GEP) {
|
|||||||
Builder->CreateInBoundsGEP(StrippedPtr, Off, GEP.getName()) :
|
Builder->CreateInBoundsGEP(StrippedPtr, Off, GEP.getName()) :
|
||||||
Builder->CreateGEP(StrippedPtr, Off, GEP.getName());
|
Builder->CreateGEP(StrippedPtr, Off, GEP.getName());
|
||||||
// The NewGEP must be pointer typed, so must the old one -> BitCast
|
// The NewGEP must be pointer typed, so must the old one -> BitCast
|
||||||
if (StrippedPtrTy->getAddressSpace() == GEP.getPointerAddressSpace())
|
return CastInst::CreatePointerBitCastOrAddrSpaceCast(NewGEP,
|
||||||
return new BitCastInst(NewGEP, GEP.getType());
|
GEP.getType());
|
||||||
return new AddrSpaceCastInst(NewGEP, GEP.getType());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user