@@ -1398,15 +1398,6 @@ class BlockPartitionState {
1398
1398
}
1399
1399
1400
1400
public:
1401
- // / Run the passed action on each partitionOp in this block. Action should
1402
- // / return true iff iteration should continue.
1403
- void forEachPartitionOp (
1404
- llvm::function_ref<bool (const PartitionOp &)> action) const {
1405
- for (const PartitionOp &partitionOp : blockPartitionOps)
1406
- if (!action (partitionOp))
1407
- break ;
1408
- }
1409
-
1410
1401
ArrayRef<PartitionOp> getPartitionOps () const { return blockPartitionOps; }
1411
1402
1412
1403
const Partition &getEntryPartition () const { return entryPartition; }
@@ -1831,15 +1822,15 @@ class RaceTracer {
1831
1822
if (!targetOp && transferredAtExitReasons.count ({SILBlock, transferredVal}))
1832
1823
return transferredAtExitReasons.at ({SILBlock, transferredVal});
1833
1824
1834
- const BlockPartitionState &block = blockStates[SILBlock];
1825
+ const BlockPartitionState &blockState = blockStates[SILBlock];
1835
1826
1836
1827
// If targetOp is null, we're checking why the value is transferred at exit,
1837
1828
// so assert that it's actually transferred at exit
1838
- assert (targetOp || block .getExitPartition ().isTransferred (transferredVal));
1829
+ assert (targetOp || blockState .getExitPartition ().isTransferred (transferredVal));
1839
1830
1840
1831
std::optional<LocalTransferredReason> transferredReason;
1841
1832
1842
- Partition workingPartition = block .getEntryPartition ();
1833
+ Partition workingPartition = blockState .getEntryPartition ();
1843
1834
1844
1835
// We are looking for a local reason, so if the value is transferred at
1845
1836
// entry, revive it for the sake of this search.
@@ -1849,10 +1840,10 @@ class RaceTracer {
1849
1840
eval.apply (PartitionOp::AssignFresh (transferredVal));
1850
1841
}
1851
1842
1852
- int i = 0 ;
1853
- block.forEachPartitionOp ([&](const PartitionOp &partitionOp) {
1843
+ for (const auto &partitionOp : blockState.getPartitionOps ()) {
1854
1844
if (targetOp == partitionOp)
1855
- return false ; // break
1845
+ break ;
1846
+
1856
1847
PartitionOpEvaluator eval (workingPartition);
1857
1848
eval.emitLog = false ;
1858
1849
eval.apply (partitionOp);
@@ -1869,16 +1860,12 @@ class RaceTracer {
1869
1860
if (!workingPartition.isTransferred (transferredVal) && transferredReason)
1870
1861
// Value is no longer transferred - e.g. reassigned or assigned fresh.
1871
1862
transferredReason = llvm::None;
1872
-
1873
- // continue walking block
1874
- i++;
1875
- return true ;
1876
- });
1863
+ }
1877
1864
1878
1865
// If we failed to find a local transfer reason, but the value was
1879
1866
// transferred at entry to the block, then the reason is "NonLocal".
1880
1867
if (!transferredReason &&
1881
- block .getEntryPartition ().isTransferred (transferredVal))
1868
+ blockState .getEntryPartition ().isTransferred (transferredVal))
1882
1869
transferredReason = LocalTransferredReason::NonLocal ();
1883
1870
1884
1871
// If transferredReason is none, then transferredVal was not actually
@@ -1902,13 +1889,14 @@ class RaceTracer {
1902
1889
1903
1890
bool printBlockSearch (raw_ostream &os, SILBasicBlock *SILBlock,
1904
1891
TrackableValueID transferredVal) const {
1905
- unsigned i = 0 ;
1906
- const BlockPartitionState &block = blockStates[SILBlock];
1907
- Partition working = block.getEntryPartition ();
1892
+ const BlockPartitionState &blockState = blockStates[SILBlock];
1893
+ Partition working = blockState.getEntryPartition ();
1908
1894
PartitionOpEvaluator eval (working);
1909
1895
os << " ┌──────────╼\n │ " ;
1910
1896
working.print (os);
1911
- block.forEachPartitionOp ([&](const PartitionOp &op) {
1897
+
1898
+ unsigned i = 0 ;
1899
+ for (const auto &op : blockState.getPartitionOps ()) {
1912
1900
os << " ├[" << i++ << " ] " ;
1913
1901
op.print (os);
1914
1902
eval.apply (op);
@@ -1917,8 +1905,7 @@ class RaceTracer {
1917
1905
os << " (" << transferredVal << " TRANSFERRED) " ;
1918
1906
}
1919
1907
working.print (os);
1920
- return true ;
1921
- });
1908
+ }
1922
1909
os << " └──────────╼\n " ;
1923
1910
return false ;
1924
1911
}
0 commit comments