[PATCH] D112284: [Clang][NFC] Clang CUDA codegen clean-up

Artem Belevich via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 26 12:45:20 PDT 2021


tra added a comment.

In D112284#3086499 <https://reviews.llvm.org/D112284#3086499>, @bondhugula wrote:

> @tra While on this, I also wanted to ask as to why clang cuda codegen is using an argument on the global ctor and the dtor it's generating.

It's a good question, and I don't have a good answer. It's quite possible that the parameter is not needed.



================
Comment at: clang/lib/CodeGen/CGCUDANV.cpp:240
         llvm::FunctionType::get(IntTy, CharPtrTy, false), "hipLaunchByPtr");
-  } else {
-    // cudaError_t cudaLaunch(char *);
-    return CGM.CreateRuntimeFunction(
-        llvm::FunctionType::get(IntTy, CharPtrTy, false), "cudaLaunch");
   }
+  // cudaError_t cudaLaunch(char *);
----------------
bondhugula wrote:
> tra wrote:
> > Nit: you could remove these `{...}` now, too.
> I retained this part due to the extra comment in line with LLVM style:
> https://llvm.org/docs/CodingStandards.html#don-t-use-braces-on-simple-single-statement-bodies-of-if-else-loop-statements
> "//We consider that readability is harmed when omitting the brace in the presence of a single statement that is accompanied by a comment (assuming the comment can’t be hoisted above the if or loop statement, see below).//"
> `assuming the comment can’t be hoisted above the if `

I think the comment can be hoisted up in this case. Up to you.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112284



More information about the cfe-commits mailing list