• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /freebsd-13-stable/contrib/llvm-project/llvm/lib/Analysis/

Lines Matching refs:GEP

2113 /// Test whether a GEP's result is known to be non-null.
2115 /// Uses properties inherent in a GEP to try to determine whether it is known
2119 static bool isGEPKnownNonNull(const GEPOperator *GEP, unsigned Depth,
2122 if (const Instruction *I = dyn_cast<Instruction>(GEP))
2125 if (!GEP->isInBounds() ||
2126 NullPointerIsDefined(F, GEP->getPointerAddressSpace()))
2130 assert(GEP->getType()->isPointerTy() && "We only support plain pointer GEP");
2133 // inbounds GEP in address space zero.
2134 if (isKnownNonZero(GEP->getPointerOperand(), Depth, Q))
2137 // Walk the GEP operands and see if any operand introduces a non-zero offset.
2138 // If so, then the GEP cannot produce a null pointer, as doing so would
2140 for (gep_type_iterator GTI = gep_type_begin(GEP), GTE = gep_type_end(GEP);
2158 // increment Depth when just zipping down an all-constant GEP.
2167 // to recurse 10k times just because we have 10k GEP operands. We don't
2391 if (const GEPOperator *GEP = dyn_cast<GEPOperator>(V))
2392 if (isGEPKnownNonNull(GEP, Depth, Q))
3879 bool llvm::isGEPBasedOnPointerToString(const GEPOperator *GEP,
3881 // Make sure the GEP has exactly three arguments.
3882 if (GEP->getNumOperands() != 3)
3887 ArrayType *AT = dyn_cast<ArrayType>(GEP->getSourceElementType());
3891 // Check to make sure that the first operand of the GEP is an integer and
3893 const ConstantInt *FirstIdx = dyn_cast<ConstantInt>(GEP->getOperand(1));
3908 // If the value is a GEP instruction or constant expression, treat it as an
3910 if (const GEPOperator *GEP = dyn_cast<GEPOperator>(V)) {
3911 // The GEP operator should be based on a pointer to string constant, and is
3913 if (!isGEPBasedOnPointerToString(GEP, ElementSize))
3920 if (const ConstantInt *CI = dyn_cast<ConstantInt>(GEP->getOperand(2)))
3924 return getConstantDataArrayInfo(GEP->getOperand(0), Slice, ElementSize,
3928 // The GEP instruction, constant or instruction, must reference a global
4150 if (GEPOperator *GEP = dyn_cast<GEPOperator>(V)) {
4151 V = GEP->getPointerOperand();
4675 if (auto *GEP = dyn_cast<GetElementPtrInst>(I))
4676 if (GEP->isInBounds())
6437 getOffsetFromIndex(const GEPOperator *GEP, unsigned Idx, const DataLayout &DL) {
6439 gep_type_iterator GTI = gep_type_begin(GEP);
6445 for (unsigned i = Idx, e = GEP->getNumOperands(); i != e; ++i, ++GTI) {
6446 ConstantInt *OpC = dyn_cast<ConstantInt>(GEP->getOperand(i));
6482 // If one pointer is a GEP see if the GEP is a constant offset from the base,
6485 // Ptr_t1 = GEP Ptr1, c1
6486 // Ptr_t2 = GEP Ptr_t1, c2
6487 // Ptr2 = GEP Ptr_t2, c3
6492 auto getOffsetFromBase = [&DL](const GEPOperator *GEP,
6494 const GEPOperator *GEP_T = GEP;
6533 // Skip any common indices and track the GEP types.