mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-15 05:24:01 +00:00
Teach InstCombine visitGetElementPtr about address spaces
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188721 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -1385,9 +1385,10 @@ Instruction *InstCombiner::commonPointerCastTransforms(CastInst &CI) {
|
||||
GEP->accumulateConstantOffset(*TD, Offset)) {
|
||||
// Get the base pointer input of the bitcast, and the type it points to.
|
||||
Value *OrigBase = BCI->getOperand(0);
|
||||
Type *GEPIdxTy = OrigBase->getType()->getPointerElementType();
|
||||
SmallVector<Value*, 8> NewIndices;
|
||||
if (FindElementAtOffset(GEPIdxTy, Offset.getSExtValue(), NewIndices)) {
|
||||
if (FindElementAtOffset(OrigBase->getType(),
|
||||
Offset.getSExtValue(),
|
||||
NewIndices)) {
|
||||
// If we were able to index down into an element, create the GEP
|
||||
// and bitcast the result. This eliminates one bitcast, potentially
|
||||
// two.
|
||||
|
Reference in New Issue
Block a user