This is an archive of the discontinued LLVM Phabricator instance.

[NFC][CUDA][HIP] rework mangling number for aux target
ClosedPublic

Authored by yaxunl on May 3 2022, 5:03 AM.

Details

Summary

CUDA/HIP needs to mangle for aux target. When mangling for aux target,
the mangler should use mangling number for aux target. Previously
in https://reviews.llvm.org/D122734 a state was introduced in
ASTContext to let the mangler get mangling number for aux target
from ASTContext. This patch removes that state from ASTConext
and add an IsAux member to MangleContext to indicate that
the mangle context is for aux target. This reflects the reality that
the mangle context is created for mangling aux target and makes
ASTContext cleaner.

Diff Detail

Event Timeline

yaxunl created this revision.May 3 2022, 5:03 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 3 2022, 5:03 AM
yaxunl added a reviewer: rnk.May 3 2022, 5:06 AM
tra accepted this revision.May 3 2022, 11:12 AM

LGTM.

clang/lib/AST/ASTContext.cpp
11770–11778

Nit: I'd rephrase it as :

if (LangOpts.CUDA && !LangOpts.CUDAIsDevice) {
    Res = ForAuxTarget ? Res >> 16 : Res & 0xFFFF; 
} else {
    assert(!ForAuxTarget && "Only CUDA/HIP host compilation supports mangling number for aux target");
}
return Res > 1 ? Res : 1;
This revision is now accepted and ready to land.May 3 2022, 11:12 AM
rnk accepted this revision.May 3 2022, 12:56 PM

lgtm, thanks!

yaxunl marked an inline comment as done.May 4 2022, 8:27 AM
yaxunl added inline comments.
clang/lib/AST/ASTContext.cpp
11770–11778

will do when committing.

This revision was automatically updated to reflect the committed changes.
yaxunl marked an inline comment as done.
Herald added a project: Restricted Project. · View Herald TranscriptMay 4 2022, 10:06 AM