Default behavior for .file directory was changed in D105856, but
ptxas (CUDA 11.5 release) refuses to parse it:
$ llc -march=nvptx64 llvm/test/DebugInfo/NVPTX/debug-file-loc.ll $ ptxas debug-file-loc.s ptxas debug-file-loc.s, line 42; fatal : Parsing error near '"foo.h"': syntax error
Added a new field to MCAsmInfo to control default value of UseDwarfDirectory.
This value is used if -dwarf-directory command line option is not specified.
I am not sure the presumably temporary ptxas issue justifies the complexity here and in MCAsmInfo.h. If you really think so strongly that llc should use non-directory .file for NVPTX, you can temporarily only change llc instead.
But as my comment suggests, it will be unneeded.