Skip to content

Conversation

LagoLunatic
Copy link
Collaborator

Fixes a bug where the pooled reference calculation would mistake the subi instruction for addi because they have the same opcode and are only distinguished by their mnemonic string.

Before:
image
After:
image

Also adds support for the addis and subis instructions, which can sometimes be used by the compiler for very large data pools:
image

Copy link
Owner

@encounter encounter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the code operated on the basic form of the instruction instead of simplified, this wouldn’t be an issue. But LGTM for a quick fix

@LagoLunatic
Copy link
Collaborator Author

If the code operated on the basic form of the instruction instead of simplified, this wouldn’t be an issue. But LGTM for a quick fix

That's a good point.

I also just checked the flow_analysis code and it looks like there's a similar pattern there that I think could theoretically cause a bug for stringBase, but I can't find any code that uses subi on a stringBase so it may not be an issue in practice.

Might be worth refactoring both of them to not use simplified form anymore.

@LagoLunatic LagoLunatic merged commit 48804dc into encounter:main Aug 23, 2025
24 checks passed
@LagoLunatic LagoLunatic deleted the subi branch August 24, 2025 03:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants