-
Notifications
You must be signed in to change notification settings - Fork 146
[CIR][CodeGen][NFC] Refactor performAddrSpaceCast
to consume CIR address space attributes
#747
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
Motive In order to fix alloca AS in #682 in a way that works seamlessly with CIR's unified address space, we intend to change Apart from that, we have several addrspace casts to fix. For example (in OG CodeGen): - LangAS AAS = getASTAllocaAddressSpace();
+ mlir::cir::AddressSpaceAttr AAS = getCIRAllocaAddressSpace();
- LangAS EAS = E->getType()->getPointeeType().getAddressSpace();
+ mlir::cir::AddressSpaceAttr EAS = builder.getAddrSpaceAttr(
+ E->getType()->getPointeeType().getAddressSpace());
if (AAS != EAS) {
// ...
return RValue::get(getTargetHooks().performAddrSpaceCast(*this, AI, AAS,
EAS, Ty));
} In this code snippets, |
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.
Seems like the logical next step to me.
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 a bunch for the more incremental changes!
…dress space attributes (llvm#747) Originally `TargetCodeGenInfo::performAddrSpaceCast` consumes two *unused* parameters typed `clang::LangAS`. This PR changes its type to `mlir::cir::AddressSpaceAttr` to better fit the need of CIRGen. In [D32248: CodeGen: Cast alloca to expected address space](https://reviews.llvm.org/D32248), the author explained why these AS parameters are not used: > This is just the default implementation. The idea is that targets that need to do something more complex on a particular conversion — e.g. to make sure that null pointers are translated correctly when they have different bit-patterns — can easily do so. Further more, I'm confident that the CIR AS is also capable of providing custom behaviors like above for those targets.
…dress space attributes (llvm#747) Originally `TargetCodeGenInfo::performAddrSpaceCast` consumes two *unused* parameters typed `clang::LangAS`. This PR changes its type to `mlir::cir::AddressSpaceAttr` to better fit the need of CIRGen. In [D32248: CodeGen: Cast alloca to expected address space](https://reviews.llvm.org/D32248), the author explained why these AS parameters are not used: > This is just the default implementation. The idea is that targets that need to do something more complex on a particular conversion — e.g. to make sure that null pointers are translated correctly when they have different bit-patterns — can easily do so. Further more, I'm confident that the CIR AS is also capable of providing custom behaviors like above for those targets.
…dress space attributes (llvm#747) Originally `TargetCodeGenInfo::performAddrSpaceCast` consumes two *unused* parameters typed `clang::LangAS`. This PR changes its type to `mlir::cir::AddressSpaceAttr` to better fit the need of CIRGen. In [D32248: CodeGen: Cast alloca to expected address space](https://reviews.llvm.org/D32248), the author explained why these AS parameters are not used: > This is just the default implementation. The idea is that targets that need to do something more complex on a particular conversion — e.g. to make sure that null pointers are translated correctly when they have different bit-patterns — can easily do so. Further more, I'm confident that the CIR AS is also capable of providing custom behaviors like above for those targets.
…dress space attributes (llvm#747) Originally `TargetCodeGenInfo::performAddrSpaceCast` consumes two *unused* parameters typed `clang::LangAS`. This PR changes its type to `mlir::cir::AddressSpaceAttr` to better fit the need of CIRGen. In [D32248: CodeGen: Cast alloca to expected address space](https://reviews.llvm.org/D32248), the author explained why these AS parameters are not used: > This is just the default implementation. The idea is that targets that need to do something more complex on a particular conversion — e.g. to make sure that null pointers are translated correctly when they have different bit-patterns — can easily do so. Further more, I'm confident that the CIR AS is also capable of providing custom behaviors like above for those targets.
…dress space attributes (#747) Originally `TargetCodeGenInfo::performAddrSpaceCast` consumes two *unused* parameters typed `clang::LangAS`. This PR changes its type to `mlir::cir::AddressSpaceAttr` to better fit the need of CIRGen. In [D32248: CodeGen: Cast alloca to expected address space](https://reviews.llvm.org/D32248), the author explained why these AS parameters are not used: > This is just the default implementation. The idea is that targets that need to do something more complex on a particular conversion — e.g. to make sure that null pointers are translated correctly when they have different bit-patterns — can easily do so. Further more, I'm confident that the CIR AS is also capable of providing custom behaviors like above for those targets.
…dress space attributes (#747) Originally `TargetCodeGenInfo::performAddrSpaceCast` consumes two *unused* parameters typed `clang::LangAS`. This PR changes its type to `mlir::cir::AddressSpaceAttr` to better fit the need of CIRGen. In [D32248: CodeGen: Cast alloca to expected address space](https://reviews.llvm.org/D32248), the author explained why these AS parameters are not used: > This is just the default implementation. The idea is that targets that need to do something more complex on a particular conversion — e.g. to make sure that null pointers are translated correctly when they have different bit-patterns — can easily do so. Further more, I'm confident that the CIR AS is also capable of providing custom behaviors like above for those targets.
Originally
TargetCodeGenInfo::performAddrSpaceCast
consumes two unused parameters typedclang::LangAS
. This PR changes its type tomlir::cir::AddressSpaceAttr
to better fit the need of CIRGen.In D32248: CodeGen: Cast alloca to expected address space, the author explained why these AS parameters are not used:
Further more, I'm confident that the CIR AS is also capable of providing custom behaviors like above for those targets.