[llvm] [SCEV] Don't add predicates already implied by UnionPredicate. (PR #93397)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Sun May 26 07:15:42 PDT 2024


================
@@ -14746,8 +14746,12 @@ void SCEVUnionPredicate::print(raw_ostream &OS, unsigned Depth) const {
 
 void SCEVUnionPredicate::add(const SCEVPredicate *N) {
   if (const auto *Set = dyn_cast<SCEVUnionPredicate>(N)) {
-    for (const auto *Pred : Set->Preds)
+    for (const auto *Pred : Set->Preds) {
+      // Skip predicates already implied by this union predicate.
+      if (implies(Pred))
+        continue;
----------------
nikic wrote:

It might be cleaner to move this to the single-predicate case below, so that one also doesn't add duplicated.

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


More information about the llvm-commits mailing list