[llvm] f81a209 - [Attributor][FIX] Deal with implicit `undef` in AAPotentialConstantValues.
Johannes Doerfert via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 4 12:45:46 PDT 2022
Author: Johannes Doerfert
Date: 2022-08-04T14:44:51-05:00
New Revision: f81a209337bbcf527e0b4adfcfedb44d798ac91d
URL: https://github.com/llvm/llvm-project/commit/f81a209337bbcf527e0b4adfcfedb44d798ac91d
DIFF: https://github.com/llvm/llvm-project/commit/f81a209337bbcf527e0b4adfcfedb44d798ac91d.diff
LOG: [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.
Added:
Modified:
llvm/lib/Transforms/IPO/AttributorAttributes.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
index 83252fec3ea89..78d3410b33298 100644
--- a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
+++ b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
@@ -9871,11 +9871,10 @@ struct AAPotentialValuesImpl : AAPotentialValues {
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 @@ struct AAPotentialValuesArgument final : AAPotentialValuesImpl {
getAnchorScope());
AnyNonLocal = true;
}
- if (undefIsContained())
- unionAssumedWithUndef();
+ assert(!undefIsContained() && "Undef should be an explicit value!");
if (AnyNonLocal)
giveUpOnIntraprocedural(A);
More information about the llvm-commits
mailing list