Commit a60050c
authored
[mlir][dataflow] Allow re-run all analyses in DataFlowSolver (#120881)
In downstream (check google/heir#1228,
especially [this
commit](ZenithalHourlyRate/heir@fbf0b27);
also check google/heir#1154) we often need to
re-run the analysis during the transformation pass as IR get changed
based on the analysis result and analysis continuously get invalidated.
There are solutions to it like `getOrCreateState` for newly created
`Value` (`AnchorT`), but warning is that the new state does not
propagate! This is quite unexpected as user of analysis would expect it
to propagate. We downstream used to use `solver->propagateIfChanged` but
that turned out to be not working, see detailed writeup in
google/heir#1153.
Just call `initializeAndRun` repeatedly also does not solve the problem
as `analysisStates` is not cleared and the monotonicity of
`AnalysisState` will make the analysis invalid as `join` will not work
as expected (the first join is no longer `join(uninitialized, init
value)`, instead it becomes `join(higher value, init value)`.
To correctly re-run the analysis, either a new `DataFlowSolver` is
created, or we can just clear the `analysisState`.1 parent 5b74fb7 commit a60050c
1 file changed
+7
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
308 | 308 | | |
309 | 309 | | |
310 | 310 | | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
311 | 315 | | |
312 | 316 | | |
313 | 317 | | |
| |||
346 | 350 | | |
347 | 351 | | |
348 | 352 | | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
349 | 356 | | |
350 | 357 | | |
351 | 358 | | |
| |||
0 commit comments