[PATCH] D88370: Emit predefined macro for wavefront size for amdgcn

Yaxun Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 30 08:56:20 PDT 2020


yaxunl added inline comments.


================
Comment at: clang/lib/Driver/ToolChains/AMDGPU.cpp:394-395
+  // Get the last argument of -mwavefrontsize64 or -mno-wavefrontsize64.
+  for (auto WaveArg : Args.filtered_reverse(options::OPT_mwavefrontsize64,
+                                            options::OPT_mno_wavefrontsize64)) {
+    if (WaveArg->getOption().getID() == options::OPT_mwavefrontsize64) {
----------------
arsenm wrote:
> yaxunl wrote:
> > arsenm wrote:
> > > Why isn't this using hasFlag?
> > > e.g. like        
> > > 
> > > ```
> > > DriverArgs.hasFlag(options::OPT_fcuda_flush_denormals_to_zero,
> > >                            options::OPT_fno_cuda_flush_denormals_to_zero,
> > >                            getDefaultDenormsAreZeroForTarget(Kind)))
> > > ```
> > hasFlag always return true or false, but here we have 3 cases : no arg, last arg is wave64, last arg is no-wave64.
> hasFlag considers all of these. The features only really need to add +wavefrontsze64 or not based on true or false, the rest is just noise
I have a simpler solution. will update


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

https://reviews.llvm.org/D88370



More information about the cfe-commits mailing list