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

Ruby Chen duke at openjdk.org
Tue Sep 2 22:04:58 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 trivial phi is not removed from its own user list before `phi.replaceBy(same, this)` is called to replace all users of the trivial phi.  
> 
> Add five tests to TestSSA: `deadCode(), ifelseLoopNested(), violaJones(), binarySearch(),` and `quicksort()`. `violaJones()` is inspired by the method `findFeaturesKernel` in HAT kernel ViolaJones.

Hi! Sorry about the confusion; I just realized this change doesn't actually fix the bug, and that the core of the problem lies in how the maps `additionalParameters` and `loads` update. 

Your original code in `tryRemoveTrivialPhi()` was correct, but when a phi is added to `additionalParameters` and is later replaced by a parameter via `replaceBy()`, both `additionalParameters` and `loads` are not updated to keep track of the new parameter. 

I can restore your code and implement those changes to make sure that the two maps replace deleted phis with appropriate values.

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

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


More information about the babylon-dev mailing list