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

[CIR][CIRGen] wip - Convert trivial copy constructor and assignment operator calls to memcpy #1270

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

shubhe25p
Copy link

@shubhe25p shubhe25p commented Jan 8, 2025

Issue #1202: Added a test file, lifetime check fails with an unexpected remark

Run command:
clang -cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -mconstructor-aliases -fclangir -fclangir-lifetime-check="history=all;remarks=all" -clangir-verify-diagnostics -emit-cir trivial.cpp

The following error is encountered:

trivial.cpp:1:8: error: unexpected remark: pset => { fn_arg:0 }
struct Trivial{ int i; };
       ^

Not sure what's wrong here? Any idea @bcardosolopes

@shubhe25p shubhe25p marked this pull request as draft January 8, 2025 21:09
@bcardosolopes
Copy link
Member

bcardosolopes commented Jan 10, 2025

There's nothing wrong there, if you look at CIR output in https://godbolt.org/z/7995W6dv9, this message is displayed for the trivial struct constructor _ZN7TrivialC2ERKS_, which is implicitly generated by the compiler, hence no much info by the message.

You are getting an error because -clangir-verify-diagnostics will turn any message into an error (this flag is only used when writing tests for the compiler). The remark is just a way to debug the lifetimecheck (enabled in -fclangir-lifetime-check="history=all;remarks=all"), and is basically saying that something is holding a pointer to the first constructor argument (which is true).

@shubhe25p
Copy link
Author

You are getting an error because -clangir-verify-diagnostics will turn any message into an error (this flag is only used when writing tests for the compiler). The remark is just a way to debug the lifetimecheck (enabled in -fclangir-lifetime-check="history=all;remarks=all"), and is basically saying that something is holding a pointer to the first constructor argument (which is true).

Thanks it makes sense, now.

There's nothing wrong there, if you look at CIR output in https://godbolt.org/z/7995W6dv9, this message is displayed for the trivial struct constructor _ZN7TrivialC2ERKS_, which is implicitly generated by the compiler, hence no much info by the message.

I’m wondering why you mentioned doing a lifetime check on this in Discord, as there isn't much information provided. Is there a specific reason for it? What else could I explore? Apologies if the question seems basic.

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