[code-reflection] RFR: Fix SSABraun bug and add SSA tests

Hannes Greule hgreule at openjdk.org
Tue Sep 9 18:52:17 UTC 2025


On Tue, 2 Sep 2025 20:30:58 GMT, Ruby Chen <duke at openjdk.org> wrote:

> Fix a bug in SSABraun where, in `tryRemoveTrivialPhi()`, a phi stored in `same` that is later deleted in a recursive `tryRemoveTrivialPhi()` call is still returned despite being deleted. 
> 
> Add five tests to TestSSA: `deadCode(), ifelseLoopNested(), violaJones(), binarySearch(),` and `quicksort()`. `violaJones()` is inspired by the method `findFeaturesKernel` in HAT kernel ViolaJones, which is the bug first presented itself.

Interesting, thanks for the investigation!

A few pointers regarding the mentioned maps:
- `additionalParameters` should only need removal at this point, as we don't need a block parameter for the new definition anymore
- The loads are updated in `replaceBy`, but there might be cases where things go wrong there
- There also is `deletedPhis`, which is supposed to correct lookups to instead look for a definition in the dominating blocks

These are the parts not present in the original algorithm due to (im)mutability, so I always suspected these to be the most fragile parts of the implementation. If you have any ideas to simplify these "workarounds", I'd be very happy :)

-------------

PR Comment: https://git.openjdk.org/babylon/pull/542#issuecomment-3247821956


More information about the babylon-dev mailing list