-
Notifications
You must be signed in to change notification settings - Fork 100
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
We can't copy trivial structs #1128
Comments
Yeah, this is part of a broader category of issues where we want to emit a constructor call instead of a memcpy to facilitate better analysis, but then we need to remove trivial constructors and convert to memcpy where possible to have parity with CodeGen. I ran into #1055 with a slightly more complex case, and #1098 is a current missed optimization. I think we'd want to emit copy constructors here and then convert to memcpy later in the pipeline somewhere. ABI lowering also comes into play for the function arguments and return values, which is another consideration. |
Thanks for replying. I feel currently CIR may be slightly low level. It should be good enough here to emit a constructor here. Such layering is helpful for analysis too. |
Yup, emitting a constructor here is good (and we've been trying to represent all constructor calls faithfully in CIR); any optimizations can come later. |
Reproducer:
when we try to emit CIR for it, we will get
clangir/clang/lib/CIR/CodeGen/CIRGenClass.cpp
Line 151 in 329aca9
The text was updated successfully, but these errors were encountered: