[PATCH] D119669: [NVPTX] Prefix "$L__" for branch label names

Artem Belevich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 14 11:17:44 PST 2022


tra accepted this revision.
tra added a comment.
This revision is now accepted and ready to land.

LGTM.

In D119669#3319853 <https://reviews.llvm.org/D119669#3319853>, @MaskRay wrote:

> Does NVPTX has such a specification?

Official spec is here: https://docs.nvidia.com/cuda/parallel-thread-execution/index.html
Unfortunately, it does not say much about labels and whether they have a concept of a local labal.

> Also, if you grep `PrivateGlobalPrefix = `, having such a long `PrivateGlobalPrefix` is an outlier.

PTX is a rather quirky assembly, so being an outlier is business as usual. :-/

For what it's worth, `$L__` is what NVCC uses since CUDA-11.3 : https://godbolt.org/z/3q4be9PrG. 
I guess `$` alone or `$L` may be sufficient to avoid name conflicts, but `$L__` is fine, too, IMO.



================
Comment at: llvm/test/CodeGen/NVPTX/label-var-prefix.ll:17
+
+; CHECK: $L__BB{{[0-9_]+}}
+L1:
----------------
You should also match the trailing `:` otherwise the check could match one of the the label uses.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D119669/new/

https://reviews.llvm.org/D119669



More information about the llvm-commits mailing list