[llvm-branch-commits] [llvm] [SeparateConstOffsetFromGEP] Preserve inbounds flag based on ValueTracking (PR #130617)

Fabian Ritter via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Mar 11 07:18:33 PDT 2025


================
@@ -1079,6 +1081,8 @@ bool SeparateConstOffsetFromGEP::splitGEP(GetElementPtrInst *GEP) {
         // and the old index if they are not used.
         RecursivelyDeleteTriviallyDeadInstructions(UserChainTail);
         RecursivelyDeleteTriviallyDeadInstructions(OldIdx);
+        MayRecoverInbounds =
+            MayRecoverInbounds && computeKnownBits(NewIdx, *DL).isNonNegative();
----------------
ritter-x2a wrote:

I added some more tests, could you please check if they cover what you meant here?
I have checked the tests with alive2 (but two of the multi-level tests timed out).

https://github.com/llvm/llvm-project/pull/130617


More information about the llvm-branch-commits mailing list