[llvm] [BasicAA] Use nuw attribute of GEPs (PR #98608)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 14 03:51:13 PDT 2024


================
@@ -552,17 +552,17 @@ struct BasicAAResult::DecomposedGEP {
   APInt Offset;
   // Scaled variable (non-constant) indices.
   SmallVector<VariableGEPIndex, 4> VarIndices;
-  // Are all operations inbounds GEPs or non-indexing operations?
+  // Nowrap flags common to all GEP operations involved in expression.
   // (std::nullopt iff expression doesn't involve any geps)
-  std::optional<bool> InBounds;
+  std::optional<GEPNoWrapFlags> NWFlags;
 
   void dump() const {
     print(dbgs());
     dbgs() << "\n";
   }
   void print(raw_ostream &OS) const {
-    OS << "(DecomposedGEP Base=" << Base->getName()
-       << ", Offset=" << Offset
+    OS << "(DecomposedGEP Base=" << Base->getName() << ", Offset=" << Offset
----------------
nikic wrote:

I'd put the `nuw` before `Offset`. A bit odd to have it between offset and indices.

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


More information about the llvm-commits mailing list