Lines Matching refs:GEP

85 Value *InstCombiner::EmitGEPOffset(User *GEP) {  in EmitGEPOffset()  argument
86 return llvm::EmitGEPOffset(Builder, DL, GEP); in EmitGEPOffset()
986 static bool shouldMergeGEPs(GEPOperator &GEP, GEPOperator &Src) { in shouldMergeGEPs() argument
990 if (GEP.hasAllZeroIndices() && !Src.hasAllZeroIndices() && in shouldMergeGEPs()
1330 Instruction *InstCombiner::visitGetElementPtrInst(GetElementPtrInst &GEP) { in visitGetElementPtrInst() argument
1331 SmallVector<Value*, 8> Ops(GEP.op_begin(), GEP.op_end()); in visitGetElementPtrInst()
1333 if (Value *V = SimplifyGEPInst(GEP.getSourceElementType(), Ops, DL, TLI, DT, AC)) in visitGetElementPtrInst()
1334 return replaceInstUsesWith(GEP, V); in visitGetElementPtrInst()
1336 Value *PtrOp = GEP.getOperand(0); in visitGetElementPtrInst()
1342 DL.getIntPtrType(GEP.getPointerOperandType()->getScalarType()); in visitGetElementPtrInst()
1344 gep_type_iterator GTI = gep_type_begin(GEP); in visitGetElementPtrInst()
1345 for (User::op_iterator I = GEP.op_begin() + 1, E = GEP.op_end(); I != E; in visitGetElementPtrInst()
1374 return &GEP; in visitGetElementPtrInst()
1388 if (Op1 == &GEP) in visitGetElementPtrInst()
1399 if (Op2 == &GEP) in visitGetElementPtrInst()
1455 GEP.getParent()->getInstList().insert( in visitGetElementPtrInst()
1456 GEP.getParent()->getFirstInsertionPt(), NewGEP); in visitGetElementPtrInst()
1474 GEP.getParent()->getInstList().insert( in visitGetElementPtrInst()
1475 GEP.getParent()->getFirstInsertionPt(), NewGEP); in visitGetElementPtrInst()
1479 GEP.setOperand(0, NewGEP); in visitGetElementPtrInst()
1488 if (!shouldMergeGEPs(*cast<GEPOperator>(&GEP), *Src)) in visitGetElementPtrInst()
1514 Value *GO1 = GEP.getOperand(1); in visitGetElementPtrInst()
1536 GEP.setOperand(0, Src->getOperand(0)); in visitGetElementPtrInst()
1537 GEP.setOperand(1, Sum); in visitGetElementPtrInst()
1538 return &GEP; in visitGetElementPtrInst()
1542 Indices.append(GEP.op_begin()+2, GEP.op_end()); in visitGetElementPtrInst()
1543 } else if (isa<Constant>(*GEP.idx_begin()) && in visitGetElementPtrInst()
1544 cast<Constant>(*GEP.idx_begin())->isNullValue() && in visitGetElementPtrInst()
1548 Indices.append(GEP.idx_begin()+1, GEP.idx_end()); in visitGetElementPtrInst()
1552 return GEP.isInBounds() && Src->isInBounds() in visitGetElementPtrInst()
1555 GEP.getName()) in visitGetElementPtrInst()
1558 GEP.getName()); in visitGetElementPtrInst()
1561 if (GEP.getNumIndices() == 1) { in visitGetElementPtrInst()
1562 unsigned AS = GEP.getPointerAddressSpace(); in visitGetElementPtrInst()
1563 if (GEP.getOperand(1)->getType()->getScalarSizeInBits() == in visitGetElementPtrInst()
1565 Type *Ty = GEP.getSourceElementType(); in visitGetElementPtrInst()
1572 V = GEP.getOperand(1); in visitGetElementPtrInst()
1574 } else if (match(GEP.getOperand(1), in visitGetElementPtrInst()
1578 } else if (match(GEP.getOperand(1), in visitGetElementPtrInst()
1593 return CastInst::Create(Instruction::IntToPtr, NewSub, GEP.getType()); in visitGetElementPtrInst()
1599 m_PtrToInt(m_Specific(GEP.getOperand(0)))))) { in visitGetElementPtrInst()
1601 GEP.getType()); in visitGetElementPtrInst()
1617 if (ConstantInt *C = dyn_cast<ConstantInt>(GEP.getOperand(1))) in visitGetElementPtrInst()
1629 dyn_cast<ArrayType>(GEP.getSourceElementType())) { in visitGetElementPtrInst()
1633 SmallVector<Value*, 8> Idx(GEP.idx_begin()+1, GEP.idx_end()); in visitGetElementPtrInst()
1635 StrippedPtrTy->getElementType(), StrippedPtr, Idx, GEP.getName()); in visitGetElementPtrInst()
1636 Res->setIsInBounds(GEP.isInBounds()); in visitGetElementPtrInst()
1637 if (StrippedPtrTy->getAddressSpace() == GEP.getAddressSpace()) in visitGetElementPtrInst()
1645 return new AddrSpaceCastInst(Builder->Insert(Res), GEP.getType()); in visitGetElementPtrInst()
1657 if (StrippedPtrTy->getAddressSpace() == GEP.getAddressSpace()) { in visitGetElementPtrInst()
1658 GEP.setOperand(0, StrippedPtr); in visitGetElementPtrInst()
1659 GEP.setSourceElementType(XATy); in visitGetElementPtrInst()
1660 return &GEP; in visitGetElementPtrInst()
1671 SmallVector<Value*, 8> Idx(GEP.idx_begin(), GEP.idx_end()); in visitGetElementPtrInst()
1672 Value *NewGEP = GEP.isInBounds() in visitGetElementPtrInst()
1674 nullptr, StrippedPtr, Idx, GEP.getName()) in visitGetElementPtrInst()
1676 GEP.getName()); in visitGetElementPtrInst()
1677 return new AddrSpaceCastInst(NewGEP, GEP.getType()); in visitGetElementPtrInst()
1681 } else if (GEP.getNumOperands() == 2) { in visitGetElementPtrInst()
1686 Type *ResElTy = GEP.getSourceElementType(); in visitGetElementPtrInst()
1690 Type *IdxType = DL.getIntPtrType(GEP.getType()); in visitGetElementPtrInst()
1691 Value *Idx[2] = { Constant::getNullValue(IdxType), GEP.getOperand(1) }; in visitGetElementPtrInst()
1693 GEP.isInBounds() in visitGetElementPtrInst()
1695 GEP.getName()) in visitGetElementPtrInst()
1696 : Builder->CreateGEP(nullptr, StrippedPtr, Idx, GEP.getName()); in visitGetElementPtrInst()
1700 GEP.getType()); in visitGetElementPtrInst()
1713 Value *Idx = GEP.getOperand(1); in visitGetElementPtrInst()
1719 assert(Idx->getType() == DL.getIntPtrType(GEP.getType()) && in visitGetElementPtrInst()
1728 GEP.isInBounds() && NSW in visitGetElementPtrInst()
1730 GEP.getName()) in visitGetElementPtrInst()
1732 GEP.getName()); in visitGetElementPtrInst()
1736 GEP.getType()); in visitGetElementPtrInst()
1752 Value *Idx = GEP.getOperand(1); in visitGetElementPtrInst()
1758 assert(Idx->getType() == DL.getIntPtrType(GEP.getType()) && in visitGetElementPtrInst()
1767 Constant::getNullValue(DL.getIntPtrType(GEP.getType())), in visitGetElementPtrInst()
1770 Value *NewGEP = GEP.isInBounds() && NSW in visitGetElementPtrInst()
1772 SrcElTy, StrippedPtr, Off, GEP.getName()) in visitGetElementPtrInst()
1774 GEP.getName()); in visitGetElementPtrInst()
1777 GEP.getType()); in visitGetElementPtrInst()
1804 unsigned OffsetBits = DL.getPointerTypeSizeInBits(GEP.getType()); in visitGetElementPtrInst()
1807 GEP.accumulateConstantOffset(DL, Offset)) { in visitGetElementPtrInst()
1822 return &GEP; in visitGetElementPtrInst()
1826 if (Operand->getType()->getPointerAddressSpace() != GEP.getAddressSpace()) in visitGetElementPtrInst()
1827 return new AddrSpaceCastInst(Operand, GEP.getType()); in visitGetElementPtrInst()
1828 return new BitCastInst(Operand, GEP.getType()); in visitGetElementPtrInst()
1837 GEP.isInBounds() in visitGetElementPtrInst()
1841 if (NGEP->getType() == GEP.getType()) in visitGetElementPtrInst()
1842 return replaceInstUsesWith(GEP, NGEP); in visitGetElementPtrInst()
1843 NGEP->takeName(&GEP); in visitGetElementPtrInst()
1845 if (NGEP->getType()->getPointerAddressSpace() != GEP.getAddressSpace()) in visitGetElementPtrInst()
1846 return new AddrSpaceCastInst(NGEP, GEP.getType()); in visitGetElementPtrInst()
1847 return new BitCastInst(NGEP, GEP.getType()); in visitGetElementPtrInst()
2359 Value *GEP = Builder->CreateInBoundsGEP(L->getType(), in visitExtractValueInst() local
2363 return replaceInstUsesWith(EV, Builder->CreateLoad(GEP)); in visitExtractValueInst()