GDA: merged simplifyCall logic into main loop#348
Merged
Conversation
I noticed that we would only optimize a call inside simplifyCall if the optimization flag was set to -O0. Inside this function, we would go through every instruction in every function, and call optimizeCall for it. We are already looping through all functions and instructions a couple of lines below it. It made sense to merge the logic and not loop through every instruction twice as long as the optimizeCall was called before handling any other intrinsic.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
optimizeCall was being invoked inside simplifyCall only when the optimization level was -O0. In its current form, simplifyCall iterates over all functions and instructions to call optimizeCall, and then performs another full iteration shortly after. This results in traversing the same instructions twice.
I merged the optimizeCall logic into the existing loop to eliminate the redundant traversal, ensuring it is executed before handling any other intrinsic so behavior remains unchanged.
I validated the change by running the test suite, particularly test/unit/codegen, and confirmed all tests pass with -O0. I also compared the generated binary sizes before and after the change and observed no differences. Additional manual tests using functions such as abs, pow, sqrt, and puts also behaved as expected.