-
Notifications
You must be signed in to change notification settings - Fork 153
[CIRGen] Convert trivial copy constructor and assignment operator calls to memcpy #1616
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your first PR.
Some things that need improvements here:
- Add a testcase (see others in clang/test/CIR for examples).
- Follow the coding guidelines: https://llvm.github.io/clangir/GettingStarted/coding-guideline.html
- Volatile: you need to detect whether it's volatile and add a
llvm_unrecheable("NYI")
(Not Yet Implemented) for it, so later on we can incrementally add volatile support and add the appropriated testcase.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM pending few minor nits
Rebase to the latest version and resolved conflicts. The latest 6 changes are to resolve tests I break. Thank you for taking a look—please let me know if you spot anything that still needs adjustment! |
I’ve resolved all test failures arising from my recent CIR CodeGen changes. After a thorough review, I’m confident there are no logic errors in the generator itself—rather, the existing tests needed to be updated to reflect the intended behavior.
|
Thanks for updating the PR. CIR currently keeps trivial copy constructor and assignment operator as calls because later passes might want to recognize the underlying semantic (which we lose after it becomes a copy), i.e. a ctor call - this can be done in CIR by looking at the attached AST node (which one day we might decide to model with their proper operations, a potential line of future work if you are interested). Note this is not the case for However, prior to LLVM lowering time we want to transform those into copies (which you did, but just a bit earlier). Ideally, instead of changing CIRGen, you can move this logic to LoweringPrepare (see some examples there and also in Let me know if you have extra questions. |
Hi, Totally understand that this optimization would be too early to apply at the CodeGen level.
I've only skimmed through the paper on LifetimeChecker and briefly looked at how pointer ownership want to handled in C++. But I'm happy to dive deeper into the implementation if needed! |
No description provided.