[llvm] [SCEV] Add canonical SCEV pointer and construct canonical SCEVs (NFC) (PR #188858)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 31 09:50:53 PDT 2026
================
@@ -80,13 +80,20 @@ struct SCEVUse : PointerIntPair<const SCEV *, 2> {
void *getRawPointer() const { return getOpaqueValue(); }
+ /// Returns true of the SCEVUse is canonical, i.e. no SCEVUse flags set in any
+ /// operands.
+ bool isCanonical() const;
+
+ /// Return the canonical SCEV for this SCEVUse.
+ const SCEV *getCanonical() const;
+
unsigned getFlags() const { return getInt(); }
bool operator==(const SCEVUse &RHS) const {
- return getRawPointer() == RHS.getRawPointer();
+ return getCanonical() == RHS.getCanonical();
----------------
fhahn wrote:
Yep, replacement is one case, the other is comparing for equality when performing simplifications; for those the flags should not matter and we actually want to compare the canonical variants. But maybe those cases are fewer, and we manually update them the compare canonical SCEVs?
For now I restored the original code comparing raw pointers
https://github.com/llvm/llvm-project/pull/188858
More information about the llvm-commits
mailing list