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

[CodeGen][Tablegen] Fix uninitialized var and shift overflow. #84896

Merged
merged 3 commits into from
Mar 13, 2024

Conversation

mahesh-attarde
Copy link
Contributor

Fix uninitialized var and shift overflow.

@mahesh-attarde mahesh-attarde changed the title Fix uninitialized var and shift overflow. [CodeGen][Tablegen] Fix uninitialized var and shift overflow. Mar 13, 2024
@@ -935,7 +935,7 @@ void DecoderEmitter::emitTable(formatted_raw_ostream &OS, DecoderTable &Table,
unsigned Shift = 0;
do {
OS << ", " << (unsigned)*I;
Value += (*I & 0x7f) << Shift;
Value += ((uint64_t)(*I & 0x7f)) << Shift;
Copy link
Contributor

Choose a reason for hiding this comment

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

Not necessary. We can confirm (*I & 0x7f) is safe to do shift.

Copy link
Contributor

Choose a reason for hiding this comment

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

+1

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, I think the (uint64_t) in needed, because Value is uint64_t and Shift may larger than 32.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i see. there are no pending issues here, can you approve & merge request?

@KanRobert KanRobert self-requested a review March 13, 2024 07:43
Copy link
Contributor

@phoebewang phoebewang left a comment

Choose a reason for hiding this comment

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

LGTM.

@phoebewang phoebewang merged commit 390f287 into llvm:main Mar 13, 2024
5 checks passed
@mahesh-attarde mahesh-attarde deleted the CMPLRLLVM-56627 branch March 13, 2024 14:04
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.

None yet

3 participants