[llvm] [BasicAA] Use nuw attribute of GEPs (PR #98608)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 15 05:28:30 PDT 2024
================
@@ -555,18 +555,18 @@ struct BasicAAResult::DecomposedGEP {
APInt Offset;
// Scaled variable (non-constant) indices.
SmallVector<VariableGEPIndex, 4> VarIndices;
- // Are all operations inbounds GEPs or non-indexing operations?
- // (std::nullopt iff expression doesn't involve any geps)
- std::optional<bool> InBounds;
+ // Nowrap flags common to all GEP operations involved in expression.
+ GEPNoWrapFlags NWFlags = GEPNoWrapFlags::all();
void dump() const {
print(dbgs());
dbgs() << "\n";
}
void print(raw_ostream &OS) const {
OS << "(DecomposedGEP Base=" << Base->getName()
- << ", Offset=" << Offset
- << ", VarIndices=[";
+ << ", inbounds=" << (NWFlags.isInBounds() ? "1" : "0")
+ << ", nuw=" << (NWFlags.hasNoUnsignedWrap() ? "1" : "0")
----------------
nikic wrote:
I'd move these before Base as well, to match `getelementptr` syntax.
https://github.com/llvm/llvm-project/pull/98608
More information about the llvm-commits
mailing list