[llvm] [SeparateConstOffsetFromGEP] Support multiple indices in reorderGEP (PR #92339)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Thu May 16 00:01:48 PDT 2024
================
@@ -997,14 +992,12 @@ bool SeparateConstOffsetFromGEP::reorderGEP(GetElementPtrInst *GEP,
bool PtrGEPInBounds = PtrGEP->isInBounds();
bool IsChainInBounds = GEPInBounds && PtrGEPInBounds;
if (IsChainInBounds) {
- auto GEPIdx = GEP->indices().begin();
- auto KnownGEPIdx = computeKnownBits(GEPIdx->get(), *DL);
- IsChainInBounds &= KnownGEPIdx.isNonNegative();
- if (IsChainInBounds) {
- auto PtrGEPIdx = PtrGEP->indices().begin();
- auto KnownPtrGEPIdx = computeKnownBits(PtrGEPIdx->get(), *DL);
- IsChainInBounds &= KnownPtrGEPIdx.isNonNegative();
- }
+ auto IsKnownNonNegative = [&](Value *V) {
----------------
arsenm wrote:
DL is the only capture, so capture by value? Is it worth providing the context instruction to the SimplifyQuery?
https://github.com/llvm/llvm-project/pull/92339
More information about the llvm-commits
mailing list