[clang] [Driver][NVPTX] Add a warning that device debug info does not work with optimizations (PR #65327)

Artem Belevich via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 18 10:03:42 PDT 2023


================
@@ -413,13 +413,25 @@ void NVPTX::Assembler::ConstructJob(Compilation &C, const JobAction &JA,
     // TODO: Perhaps we should map host -O2 to ptxas -O3. -O3 is ptxas's
     // default, so it may correspond more closely to the spirit of clang -O2.
 
+    bool noOptimization = A->getOption().matches(options::OPT_O0);
+    // Emit a driver diagnostic as warning if any -O option different from -O0,
----------------
Artem-B wrote:

This is a bit too aggressive, IMO. E.g. `-g1` or `-gmlt` works just fine.
The warning should apply only to full debug info. You should probably move the code below to where we check DIKind and issue the warning only if `DIKind == FullDebug`.

Then there's a question of whether the warning is useful in general. E.g. in a large project where optimization and debug options are controlled globally, the users will all of a sudden start getting the warnings. The builds with -Werror will be broken and the users will have no easy way to deal with that.



https://github.com/llvm/llvm-project/pull/65327


More information about the cfe-commits mailing list