From cece0a105b29dcbb9d88d0aa264c4745c07a8456 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Wed, 12 Jun 2024 11:51:41 +0200 Subject: Revert "[ConstantFold] Drop gep of gep fold entirely (#95126)" This reverts commit 3b3b839c66dc49674fd6646650525a2173030690. This broke the flang+openmp+offload buildbot, as reported in https://github.com/llvm/llvm-project/pull/95126#issuecomment-2162424019. --- llvm/lib/IR/Constants.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'llvm/lib/IR/Constants.cpp') diff --git a/llvm/lib/IR/Constants.cpp b/llvm/lib/IR/Constants.cpp index d079073..a76be44 100644 --- a/llvm/lib/IR/Constants.cpp +++ b/llvm/lib/IR/Constants.cpp @@ -2438,7 +2438,8 @@ Constant *ConstantExpr::getGetElementPtr(Type *Ty, Constant *C, assert(Ty && "Must specify element type"); assert(isSupportedGetElementPtr(Ty) && "Element type is unsupported!"); - if (Constant *FC = ConstantFoldGetElementPtr(Ty, C, InRange, Idxs)) + if (Constant *FC = + ConstantFoldGetElementPtr(Ty, C, NW.isInBounds(), InRange, Idxs)) return FC; // Fold a few common cases. assert(GetElementPtrInst::getIndexedType(Ty, Idxs) && "GEP indices invalid!"); -- cgit v1.1