[llvm] [ConstraintElim] Use constraints from bounded memory accesses (PR #155253)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 26 09:17:36 PDT 2025


================
@@ -1109,10 +1113,43 @@ void State::addInfoForInductions(BasicBlock &BB) {
   }
 }
 
+static bool getConstraintFromMemoryAccess(GetElementPtrInst &GEP,
+                                          uint64_t AccessSize,
+                                          CmpPredicate &Pred, Value *&A,
+                                          Value *&B, const DataLayout &DL,
+                                          const TargetLibraryInfo &TLI) {
+  auto Offset = collectOffsets(cast<GEPOperator>(GEP), DL);
+  if (!Offset.NW.isInBounds())
----------------
nikic wrote:

Yes, but it is UB to access that pointer due to provenance. As you are reasoning based on accesses and not just plain GEPs, you don't need inbounds.

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


More information about the llvm-commits mailing list