-
Notifications
You must be signed in to change notification settings - Fork 11.9k
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
[NVPTX][NFC] Use same logic to get alignment in param declarations and function prototypes #98220
[NVPTX][NFC] Use same logic to get alignment in param declarations and function prototypes #98220
Conversation
Thank you for submitting a Pull Request (PR) to the LLVM Project! This PR will be automatically labeled and the relevant teams will be If you wish to, you can add reviewers by using the "Reviewers" section on this page. If this is not working for you, it is probably because you do not have write If you have received no comments on your PR for a week, you can request a review If you have further questions, they may be answered by the LLVM GitHub User Guide. You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums. |
…d function prototypes
38f5d9c
to
d4e39c1
Compare
@llvm/pr-subscribers-backend-nvptx Author: Kevin McAfee (kalxr) ChangesUnifies the logic used to choose function prototype argument alignment and param alignment declared in the caller. The call in Full diff: https://github.com/llvm/llvm-project/pull/98220.diff 1 Files Affected:
diff --git a/llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp b/llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp
index 26c16ee9fd18f..9fccfb26eb6fe 100644
--- a/llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp
+++ b/llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp
@@ -1438,10 +1438,8 @@ std::string NVPTXTargetLowering::getPrototype(
if (!Outs[OIdx].Flags.isByVal()) {
if (IsTypePassedAsArray(Ty)) {
- const CallInst *CallI = cast<CallInst>(&CB);
Align ParamAlign =
- getAlign(*CallI, i + AttributeList::FirstArgIndex)
- .value_or(getFunctionParamOptimizedAlign(F, Ty, DL));
+ getArgumentAlignment(&CB, Ty, i + AttributeList::FirstArgIndex, DL);
O << ".param .align " << ParamAlign.value() << " .b8 ";
O << "_";
O << "[" << DL.getTypeAllocSize(Ty) << "]";
|
I don't have commit access, could you please merge for me @Artem-B ? |
@kalxr Congratulations on having your first Pull Request (PR) merged into the LLVM Project! Your changes will be combined with recent changes from other authors, then tested Please check whether problems have been caused by your change specifically, as How to do this, and the rest of the post-merge process, is covered in detail here. If your change does cause a problem, it may be reverted, or you can revert it yourself. If you don't get any reports, no action is required from you. Your changes are working as expected, well done! |
Merged at @kalxr’s (offline) request. |
…d function prototypes (llvm#98220) Unifies the logic used to choose function prototype argument alignment and param alignment declared in the caller. The call in `getPrototype` to `getAlign`/`getFunctionParamOptimizedAlign` is replaced with `getArgumentAlignment`, which is what is currently used to select the alignment for the param declarations. This avoids code duplication of `getAlign().value_or(getFunctionParamOptimizedAlign())` and ensures that param alignments are the same in declarations and prototypes.
Unifies the logic used to choose function prototype argument alignment and param alignment declared in the caller. The call in
getPrototype
togetAlign
/getFunctionParamOptimizedAlign
is replaced withgetArgumentAlignment
, which is what is currently used to select the alignment for the param declarations. This avoids code duplication ofgetAlign().value_or(getFunctionParamOptimizedAlign())
and ensures that param alignments are the same in declarations and prototypes.