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

Combine global_init and global_stmts functions into global_stmts #2696

Merged
merged 5 commits into from
May 11, 2024

Conversation

Vipul-Cariappa
Copy link
Contributor

Fixes: #2573

Comment on lines 4878 to 4885
if (!global_init.empty()) {
for (auto t: global_init) {
if (t) {
items.push_back(al, t);
global_init.erase(t);
}
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this can be simplified to

Suggested change
if (!global_init.empty()) {
for (auto t: global_init) {
if (t) {
items.push_back(al, t);
global_init.erase(t);
}
}
}
for (auto t: global_init) {
if (t) {
items.push_back(al, t);
}
}
global_init.n = 0;

@Shaikh-Ubaid
Copy link
Collaborator

Please add the test case in #2573 (comment) as integration test. Please ensure you add assert and print before the assert appropriately.

@Shaikh-Ubaid Shaikh-Ubaid marked this pull request as draft May 11, 2024 05:30
@Shaikh-Ubaid
Copy link
Collaborator

Please mark this PR as "Ready for Review" when ready.

@Vipul-Cariappa Vipul-Cariappa marked this pull request as ready for review May 11, 2024 05:52
@@ -508,6 +508,8 @@ RUN(NAME expr_02u LABELS cpython llvm llvm_jit c NOFAST)
RUN(NAME expr_03u LABELS cpython llvm llvm_jit c NOFAST)
RUN(NAME expr_04u LABELS cpython llvm llvm_jit c)

RUN(NAME list_01 LABELS cpython llvm llvm_jit c)
Copy link
Collaborator

Choose a reason for hiding this comment

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

It seems this test fails withc backend at the CI. So let's remove it.

Suggested change
RUN(NAME list_01 LABELS cpython llvm llvm_jit c)
RUN(NAME list_01 LABELS cpython llvm llvm_jit)

Copy link
Collaborator

@Shaikh-Ubaid Shaikh-Ubaid left a comment

Choose a reason for hiding this comment

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

It looks good. Thanks!

@Shaikh-Ubaid Shaikh-Ubaid merged commit 9817f8a into lcompilers:main May 11, 2024
14 checks passed
@Vipul-Cariappa Vipul-Cariappa deleted the combine-init-and-stmts branch May 12, 2024 13:11
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.

[Bug] All global variable assignments should not go to __main__global_init
2 participants