Skip to content

Commit d2bdec2

Browse files
committed
[region-isolation] Include the region -> transferring operand map in the dataflow convergence.
The reason why I am doing this is that really we are running two different dataflow equations at the same time... one for propagating tracking transferring sets and the other for propagating regions. Since at the source level the two dataflow problems are very interrelated, I was unable to come up with an example where we fail to iterate because of this, but I would like to be sure that we do not hit one, so I am fixing this here. rdar://126170014
1 parent ca8179a commit d2bdec2

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

include/swift/SILOptimizer/Utils/PartitionUtils.h

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,12 @@
1919
#include "swift/Basic/LLVM.h"
2020
#include "swift/SIL/SILFunction.h"
2121
#include "swift/SIL/SILInstruction.h"
22+
2223
#include "llvm/ADT/MapVector.h"
24+
#include "llvm/ADT/STLExtras.h"
2325
#include "llvm/ADT/SmallVector.h"
2426
#include "llvm/Support/Debug.h"
27+
2528
#include <algorithm>
2629
#include <variant>
2730

@@ -705,7 +708,16 @@ class Partition {
705708
fst.canonicalize();
706709
snd.canonicalize();
707710

708-
return fst.elementToRegionMap == snd.elementToRegionMap;
711+
return fst.elementToRegionMap == snd.elementToRegionMap &&
712+
fst.regionToTransferredOpMap.size() ==
713+
snd.regionToTransferredOpMap.size() &&
714+
llvm::all_of(
715+
fst.regionToTransferredOpMap,
716+
[&snd](const std::pair<Region, TransferringOperandSet *> &p) {
717+
auto sndIter = snd.regionToTransferredOpMap.find(p.first);
718+
return sndIter != snd.regionToTransferredOpMap.end() &&
719+
sndIter->second == p.second;
720+
});
709721
}
710722

711723
bool isTrackingElement(Element val) const {

0 commit comments

Comments
 (0)