@@ -827,7 +827,7 @@ Constant *SymbolicallyEvaluateBinop(unsigned Opc, Constant *Op0, Constant *Op1,
827827// / If array indices are not pointer-sized integers, explicitly cast them so
828828// / that they aren't implicitly casted by the getelementptr.
829829Constant *CastGEPIndices (Type *SrcElemTy, ArrayRef<Constant *> Ops,
830- Type *ResultTy, bool InBounds ,
830+ Type *ResultTy, GEPNoWrapFlags NW ,
831831 std::optional<ConstantRange> InRange,
832832 const DataLayout &DL, const TargetLibraryInfo *TLI) {
833833 Type *IntIdxTy = DL.getIndexType (ResultTy);
@@ -856,8 +856,8 @@ Constant *CastGEPIndices(Type *SrcElemTy, ArrayRef<Constant *> Ops,
856856 if (!Any)
857857 return nullptr ;
858858
859- Constant *C = ConstantExpr::getGetElementPtr (SrcElemTy, Ops[ 0 ], NewIdxs,
860- InBounds , InRange);
859+ Constant *C =
860+ ConstantExpr::getGetElementPtr (SrcElemTy, Ops[ 0 ], NewIdxs, NW , InRange);
861861 return ConstantFoldConstant (C, DL, TLI);
862862}
863863
@@ -873,7 +873,7 @@ Constant *SymbolicallyEvaluateGEP(const GEPOperator *GEP,
873873 if (!SrcElemTy->isSized () || isa<ScalableVectorType>(SrcElemTy))
874874 return nullptr ;
875875
876- if (Constant *C = CastGEPIndices (SrcElemTy, Ops, ResTy, GEP->isInBounds (),
876+ if (Constant *C = CastGEPIndices (SrcElemTy, Ops, ResTy, GEP->getNoWrapFlags (),
877877 GEP->getInRange (), DL, TLI))
878878 return C;
879879
0 commit comments