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

[refactor] [ir] Remove load_if_ptr and move pointer dereferencing to frontend-to-IR passes #4104

Merged
merged 1 commit into from
Jan 27, 2022

Conversation

re-xyr
Copy link
Contributor

@re-xyr re-xyr commented Jan 24, 2022

Related issue = #3982

Frontend IR is supposed to be a language higher level than ChiIR, but unnecessary details of pointer manipulation (i.e. LoadExpressions) are still present. Although users won't be able to notice this in python, that was achieved by spreading load_if_ptr across literally the whole frontend. What's worse, for any expression e, LoadExpression(e) has the same types as e (that is, value type = pointer type), making bugs extremely easy to sneak in.

This PR removed LoadExpressions and load_if_ptr so that pointers are not visible in frontend. Instead, pointer dereferencing is done at frontend-to-IR passes (Expr::flatten() and irpass::lower_ast()) wtih helper functions flatten_lvalue() (gives pointers) and flatten_rvalue() (gives values).

@vercel
Copy link

vercel bot commented Jan 24, 2022

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/taichi-api-docs-preview/taichi/7B91tXiAHYKAe9T4sUvtHaSDPNYd
✅ Preview: Canceled

[Deployment for 2682531 canceled]

@netlify
Copy link

netlify bot commented Jan 24, 2022

✔️ Deploy Preview for docsite-preview ready!

🔨 Explore the source changes: 2682531

🔍 Inspect the deploy log: https://app.netlify.com/sites/docsite-preview/deploys/61f0fdaa0bf8870008ada8dc

😎 Browse the preview: https://deploy-preview-4104--docsite-preview.netlify.app

Copy link
Contributor

@strongoier strongoier left a comment

Choose a reason for hiding this comment

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

Great work!

nit: remove load_if_ptr from expr.h

tests/cpp/ir/frontend_type_inference_test.cpp Outdated Show resolved Hide resolved
tests/cpp/ir/frontend_type_inference_test.cpp Outdated Show resolved Hide resolved
@strongoier
Copy link
Contributor

nit: remove load_if_ptr from expr.h

Remember to do this :-)

@strongoier strongoier merged commit 7be68aa into taichi-dev:master Jan 27, 2022
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