// __kmpc_target_init or
// __kmpc_target_deinit call. We will answer this one with the internal
// state.
- if (!isValidState())
+ if (!SPMDCompatibilityTracker.isValidState())
return nullptr;
if (!SPMDCompatibilityTracker.isAtFixpoint()) {
if (AA)
};
bool UsedAssumedInformationInCheckRWInst = false;
- if (!A.checkForAllReadWriteInstructions(
- CheckRWInst, *this, UsedAssumedInformationInCheckRWInst))
- SPMDCompatibilityTracker.indicatePessimisticFixpoint();
+ if (!SPMDCompatibilityTracker.isAtFixpoint())
+ if (!A.checkForAllReadWriteInstructions(
+ CheckRWInst, *this, UsedAssumedInformationInCheckRWInst))
+ SPMDCompatibilityTracker.indicatePessimisticFixpoint();
if (!IsKernelEntry)
updateReachingKernelEntries(A);
// Callback to check a call instruction.
+ bool AllSPMDStatesWereFixed = true;
auto CheckCallInst = [&](Instruction &I) {
auto &CB = cast<CallBase>(I);
auto &CBAA = A.getAAFor<AAKernelInfo>(
*this, IRPosition::callsite_function(CB), DepClassTy::OPTIONAL);
- if (CBAA.getState().isValidState())
- getState() ^= CBAA.getState();
+ getState() ^= CBAA.getState();
+ AllSPMDStatesWereFixed &= CBAA.SPMDCompatibilityTracker.isAtFixpoint();
return true;
};
CheckCallInst, *this, UsedAssumedInformationInCheckCallInst))
return indicatePessimisticFixpoint();
+ // If we haven't used any assumed information for the SPMD state we can fix
+ // it.
+ if (!UsedAssumedInformationInCheckRWInst &&
+ !UsedAssumedInformationInCheckCallInst && AllSPMDStatesWereFixed)
+ SPMDCompatibilityTracker.indicateOptimisticFixpoint();
+
return StateBefore == getState() ? ChangeStatus::UNCHANGED
: ChangeStatus::CHANGED;
}