Commit e41fd47
authored
Improve
The `argmax` and `argmin` patterns in AssociativeOpsTable assumed that
comparisons would be normalized to `y < x` (or `x < y`), but the Solve
module could flip these. It was also possible an earlier pass would
negate the patterns such that `y >= x` (or `x >= y`) with the branches
reversed could be encountered instead.
To solve this issue, we extend Solve to move the variable of interest
to the `true` branch of a `select`. We also extend the table to cover
all four comparison cases.
We also substantially refactor Solve.cpp to use a helper to track and
update the ambient tree traversal state (`uses_var` and `failed`).argmax patterns for rfactor (#8863)1 parent d40a56e commit e41fd47
File tree
5 files changed
+193
-187
lines changed- src
- test/correctness
5 files changed
+193
-187
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
177 | 177 | | |
178 | 178 | | |
179 | 179 | | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
180 | 183 | | |
| 184 | + | |
181 | 185 | | |
182 | 186 | | |
183 | 187 | | |
184 | 188 | | |
| 189 | + | |
185 | 190 | | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
186 | 194 | | |
187 | 195 | | |
188 | 196 | | |
| |||
348 | 356 | | |
349 | 357 | | |
350 | 358 | | |
351 | | - | |
| 359 | + | |
352 | 360 | | |
353 | 361 | | |
354 | 362 | | |
355 | 363 | | |
356 | 364 | | |
357 | | - | |
358 | | - | |
359 | | - | |
360 | | - | |
361 | | - | |
362 | | - | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
363 | 371 | | |
364 | | - | |
365 | | - | |
| 372 | + | |
| 373 | + | |
366 | 374 | | |
367 | 375 | | |
368 | 376 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
526 | 526 | | |
527 | 527 | | |
528 | 528 | | |
529 | | - | |
| 529 | + | |
530 | 530 | | |
531 | 531 | | |
532 | 532 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
608 | 608 | | |
609 | 609 | | |
610 | 610 | | |
611 | | - | |
| 611 | + | |
612 | 612 | | |
613 | 613 | | |
614 | 614 | | |
| |||
0 commit comments