Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse constant cmp operand IDs using absolute encoding #267

Merged
merged 2 commits into from
Jan 30, 2024

Conversation

RyanGlScott
Copy link
Contributor

As noted in #266 (comment), the operand IDs in constant expressions use an absolute encoding. This means that parsing constant icmp expressions with getConstantFwdRefAdjustedId (which assumes a relative encoding) is incorrect. All forms of constant expressions besides constant icmp expressions use forwardRef (which assumes an absolute encoding) to parse their value operands, so constant icmp expressions are the odd one out.

This patch fixes the parsing of constant icmp expression operands by (1) removing the getConstantFwdRefAdjustedId function, and (2) switching to using forwardRef.

Fixes #266.

This function is unused and, as noted in
#266 (comment),
is almost certainly incorrect.
As noted in
#266 (comment),
the operand IDs in constant expressions use an absolute encoding. This means
that parsing constant `icmp` expressions with `getConstantFwdRefAdjustedId`
(which assumes a relative encoding) is incorrect. All forms of constant
expressions besides constant `icmp` expressions use `forwardRef` (which assumes
an absolute encoding) to parse their value operands, so constant `icmp`
expressions are the odd one out.

This patch fixes the parsing of constant `icmp` expression operands by (1)
removing the `getConstantFwdRefAdjustedId` function, and (2) switching to using
`forwardRef`.

Fixes #266.
@RyanGlScott RyanGlScott merged commit b0e129f into master Jan 30, 2024
46 checks passed
@RyanGlScott RyanGlScott deleted the T266-constant-forwardRef branch January 30, 2024 17:03
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.

llvm-pretty-bc-parser drops constant ptrtoint expression
3 participants