[Attributor][FIX] Deal with implicit `undef` in AAPotentialConstantValues.
In contrast to AAPotentialValues, the constant values version can
contain implicit `undef` in the set. We had an assertion that could
misfire before. Handle it properly now.
GitOrigin-RevId: f81a209337bbcf527e0b4adfcfedb44d798ac91d
diff --git a/lib/Transforms/IPO/AttributorAttributes.cpp b/lib/Transforms/IPO/AttributorAttributes.cpp
index 83252fe..78d3410 100644
--- a/lib/Transforms/IPO/AttributorAttributes.cpp
+++ b/lib/Transforms/IPO/AttributorAttributes.cpp
@@ -9871,11 +9871,10 @@
auto &PotentialConstantsAA = A.getAAFor<AAPotentialConstantValues>(
*this, ValIRP, DepClassTy::OPTIONAL);
if (PotentialConstantsAA.isValidState()) {
- for (auto &It : PotentialConstantsAA.getAssumedSet()) {
+ for (auto &It : PotentialConstantsAA.getAssumedSet())
State.unionAssumed({{*ConstantInt::get(&Ty, It), nullptr}, S});
- }
- assert(!PotentialConstantsAA.undefIsContained() &&
- "Undef should be an explicit value!");
+ if (PotentialConstantsAA.undefIsContained())
+ State.unionAssumed({{*UndefValue::get(&Ty), nullptr}, S});
return;
}
}
@@ -10406,8 +10405,7 @@
getAnchorScope());
AnyNonLocal = true;
}
- if (undefIsContained())
- unionAssumedWithUndef();
+ assert(!undefIsContained() && "Undef should be an explicit value!");
if (AnyNonLocal)
giveUpOnIntraprocedural(A);