[clang] [llvm] [NVPTX] Add NVVMUpgradeAnnotations pass to cleanup legacy annotations (PR #119261)
Artem Belevich via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 10 13:54:51 PST 2024
================
@@ -324,14 +326,15 @@ MaybeAlign getAlign(const Function &F, unsigned Index) {
F.getAttributes().getAttributes(Index).getStackAlignment())
return StackAlign;
- // If that is missing, check the legacy nvvm metadata
- std::vector<unsigned> Vs;
- bool retval = findAllNVVMAnnotation(&F, "align", Vs);
- if (!retval)
- return std::nullopt;
- for (unsigned V : Vs)
- if ((V >> 16) == Index)
- return Align(V & 0xFFFF);
+ // check the legacy nvvm metadata only for the return value since llvm does
+ // not support stackalign attribute for this.
+ if (Index == 0) {
+ std::vector<unsigned> Vs;
+ if (findAllNVVMAnnotation(&F, "align", Vs))
----------------
Artem-B wrote:
Offtopic: I think if `findAllNVVMAnnotation()` returned `ArrayRef` it would work much nicer than copying data into a temp array.
```
if (Index == 0) {
for (unsigned V : findAllNVVMAnnotation())
do stuff;
}
```
https://github.com/llvm/llvm-project/pull/119261
More information about the llvm-commits
mailing list