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

Break down emitStoresForConstant into optimized operations #466

Open
bcardosolopes opened this issue Feb 14, 2024 · 4 comments
Open

Break down emitStoresForConstant into optimized operations #466

bcardosolopes opened this issue Feb 14, 2024 · 4 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@bcardosolopes
Copy link
Member

The function in emitStoresForConstant in clang/lib/CIR/CodeGen/CIRGenDecl.cpp contains lots of unimplemented heuristics, namely:

  assert(!UnimplementedFeature::addAutoInitAnnotation());
  assert(!UnimplementedFeature::vectorConstants());
  assert(!UnimplementedFeature::shouldUseBZeroPlusStoresToInitialize());
  assert(!UnimplementedFeature::shouldUseMemSetToInitialize());
  assert(!UnimplementedFeature::shouldSplitConstantStore());
  assert(!UnimplementedFeature::shouldCreateMemCpyFromGlobal());

Those should be implemented in LoweringPrepare. Some context from a previous PR follows:

The original codegen doesn't have this problem at all, there is just a memcpy there, I provide LLVM IR just for reference:

Right, this one sounds like UnimplementedFeature::shouldCreateMemCpyFromGlobal(), which can now be implemented in LoweringPrepare (we didn't had it before). Out of curiosity, what LLVM lowering do we get for this right now?

Originally posted by @bcardosolopes in #463 (comment)

@Ris-Bali
Copy link

Ris-Bali commented Feb 18, 2024

I would like to work on this. I found the implementation of some of these functions in clang/CodeGen/CGDecl.cpp for reference ; although I couldn't find most of the functions there. Is there any other place I can look for the implementation ? Or are these functions named differently in clang codegen.

@bcardosolopes
Copy link
Member Author

bcardosolopes commented Feb 20, 2024

Hi! These functions don't exist, their names refer to snippets of code in traditional CodeGen that needs to be implemented in ClangIR as part of LoweringPrepare.

@Ris-Bali
Copy link

Ris-Bali commented Feb 20, 2024

Hi! These functions don't exist, their names refer to snippets of code in traditional CodeGen that needs to be implemented in ClangIR as part of LoweringPrepare.

Thanks for replying, there has been a misunderstanding I meant I am referring to these functions in the traditional clang codegen for implementing these operations in clangIR; although I couldn't find some of the above snippets there eg : shouldCreateMemCpyFromGlobal(maybe named differently ?). I'll start by working on the functions I found in clang's codegen.

@bcardosolopes
Copy link
Member Author

Sure, starting by the easier ones is the way to go. Please work on them incrementally, one PR each!

above snippets there eg : shouldCreateMemCpyFromGlobal(maybe named differently ?)

That one doesn't have a snippet necessarily, it's just tracking lacking behavior, see #463 (comment) for more details

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants