Skip to content

Commit e96dcac

Browse files
committed
Make sure we always have a SILFunction for region-based isolation checking
Some values (such as `undef`) might not be associated with a function.
1 parent dc85ae3 commit e96dcac

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

include/swift/SILOptimizer/Analysis/RegionAnalysis.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,11 @@ class RegionAnalysisValueMap {
299299
/// This only includes function arguments.
300300
std::vector<TrackableValueID> neverTransferredValueIDs;
301301

302+
SILFunction *fn;
303+
302304
public:
305+
RegionAnalysisValueMap(SILFunction *fn) : fn(fn) { }
306+
303307
/// Returns the value for this instruction if it isn't a fake "represenative
304308
/// value" to inject actor isolatedness. Asserts in such a case.
305309
SILValue getRepresentative(Element trackableValueID) const;

lib/SILOptimizer/Analysis/RegionAnalysis.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2751,8 +2751,9 @@ static bool canComputeRegionsForFunction(SILFunction *fn) {
27512751

27522752
RegionAnalysisFunctionInfo::RegionAnalysisFunctionInfo(
27532753
SILFunction *fn, PostOrderFunctionInfo *pofi)
2754-
: allocator(), fn(fn), translator(), ptrSetFactory(allocator),
2755-
blockStates(), pofi(pofi), solved(false), supportedFunction(true) {
2754+
: allocator(), fn(fn), valueMap(fn), translator(),
2755+
ptrSetFactory(allocator), blockStates(), pofi(pofi), solved(false),
2756+
supportedFunction(true) {
27562757
// Before we do anything, make sure that we support processing this function.
27572758
//
27582759
// NOTE: See documentation on supportedFunction for criteria.
@@ -2954,7 +2955,7 @@ TrackableValue RegionAnalysisValueMap::getTrackableValue(
29542955
}
29552956

29562957
// Otherwise refer to the oracle.
2957-
if (!isNonSendableType(value->getType(), value->getFunction()))
2958+
if (!isNonSendableType(value->getType(), fn))
29582959
iter.first->getSecond().addFlag(TrackableValueFlag::isSendable);
29592960

29602961
// Check if our base is a ref_element_addr from an actor. In such a case,

0 commit comments

Comments
 (0)