@@ -2033,6 +2033,13 @@ namespace {
2033
2033
struct AANoUnwindImpl : AANoUnwind {
2034
2034
AANoUnwindImpl (const IRPosition &IRP, Attributor &A) : AANoUnwind(IRP, A) {}
2035
2035
2036
+ // / See AbstractAttribute::initialize(...).
2037
+ void initialize (Attributor &A) override {
2038
+ bool IsKnown;
2039
+ assert (!AA::hasAssumedIRAttr<Attribute::NoUnwind>(
2040
+ A, nullptr , getIRPosition (), DepClassTy::NONE, IsKnown));
2041
+ }
2042
+
2036
2043
const std::string getAsStr (Attributor *A) const override {
2037
2044
return getAssumed () ? " nounwind" : " may-unwind" ;
2038
2045
}
@@ -2049,10 +2056,10 @@ struct AANoUnwindImpl : AANoUnwind {
2049
2056
return true ;
2050
2057
2051
2058
if (const auto *CB = dyn_cast<CallBase>(&I)) {
2052
- bool IsKnown ;
2059
+ bool IsKnownNoUnwind ;
2053
2060
return AA::hasAssumedIRAttr<Attribute::NoUnwind>(
2054
2061
A, this , IRPosition::callsite_function (*CB), DepClassTy::REQUIRED,
2055
- IsKnown );
2062
+ IsKnownNoUnwind );
2056
2063
}
2057
2064
return false ;
2058
2065
};
@@ -2087,9 +2094,9 @@ struct AANoUnwindCallSite final : AANoUnwindImpl {
2087
2094
// redirecting requests to the callee argument.
2088
2095
Function *F = getAssociatedFunction ();
2089
2096
const IRPosition &FnPos = IRPosition::function (*F);
2090
- bool IsKnown ;
2097
+ bool IsKnownNoUnwind ;
2091
2098
if (AA::hasAssumedIRAttr<Attribute::NoUnwind>(
2092
- A, this , FnPos, DepClassTy::REQUIRED, IsKnown ))
2099
+ A, this , FnPos, DepClassTy::REQUIRED, IsKnownNoUnwind ))
2093
2100
return ChangeStatus::UNCHANGED;
2094
2101
return indicatePessimisticFixpoint ();
2095
2102
}
@@ -4340,12 +4347,11 @@ struct AAIsDeadValueImpl : public AAIsDead {
4340
4347
return false ;
4341
4348
4342
4349
const IRPosition &CallIRP = IRPosition::callsite_function (*CB);
4343
- const auto *NoUnwindAA =
4344
- A.getAndUpdateAAFor <AANoUnwind>(*this , CallIRP, DepClassTy::NONE);
4345
- if (!NoUnwindAA || !NoUnwindAA->isAssumedNoUnwind ())
4350
+
4351
+ bool IsKnownNoUnwind;
4352
+ if (!AA::hasAssumedIRAttr<Attribute::NoUnwind>(
4353
+ A, this , CallIRP, DepClassTy::OPTIONAL, IsKnownNoUnwind))
4346
4354
return false ;
4347
- if (!NoUnwindAA || !NoUnwindAA->isKnownNoUnwind ())
4348
- A.recordDependence (*NoUnwindAA, *this , DepClassTy::OPTIONAL);
4349
4355
4350
4356
bool IsKnown;
4351
4357
return AA::isAssumedReadOnly (A, CallIRP, *this , IsKnown);
@@ -4872,10 +4878,11 @@ identifyAliveSuccessors(Attributor &A, const InvokeInst &II,
4872
4878
AliveSuccessors.push_back (&II.getUnwindDest ()->front ());
4873
4879
} else {
4874
4880
const IRPosition &IPos = IRPosition::callsite_function (II);
4875
- const auto *AANoUnw =
4876
- A.getAndUpdateAAFor <AANoUnwind>(AA, IPos, DepClassTy::OPTIONAL);
4877
- if (AANoUnw && AANoUnw->isAssumedNoUnwind ()) {
4878
- UsedAssumedInformation |= !AANoUnw->isKnownNoUnwind ();
4881
+
4882
+ bool IsKnownNoUnwind;
4883
+ if (AA::hasAssumedIRAttr<Attribute::NoUnwind>(
4884
+ A, &AA, IPos, DepClassTy::OPTIONAL, IsKnownNoUnwind)) {
4885
+ UsedAssumedInformation |= !IsKnownNoUnwind;
4879
4886
} else {
4880
4887
AliveSuccessors.push_back (&II.getUnwindDest ()->front ());
4881
4888
}
0 commit comments