r211844 - Add test coverage for .bc input in the frontend

Alp Toker alp at nuanti.com
Sun Jun 29 15:47:14 PDT 2014


On 30/06/2014 00:53, Rafael EspĂ­ndola wrote:
>> Any idea why ELF assembly emits this special initial '.file' directive
>> that's derived from the active tool's input filename rather than IR, as with
>> subsequent '.file' directives? (Or, indeed why the other asm formats don't
>> share the behaviour?)
> It is confusing. There are two .file directives in ELF:
>
> .file foo  -> this produces a FILE symbol with that name.
> .file num foo -> this creates a debug info file with number num.
>
> I agree that the ".file foo" directive should not use the IL name and
> should instead be encoded in the IL, like we do for .ident.

CCing in llvmdev..

The only test coverage for this feature is CodeGen/X86/GC/ocaml-gc.ll 
where it contains an equally unhelpful value:

-; CHECK-NEXT:   .file   "<stdin>"

So I agree, it looks like this is breaking an invariant in the 
compilation pipeline by causing us to not generate identical output from 
identical inputs. Also like an information leak to emit file paths on 
the build system when they weren't requested.

If it's been wrong and untested so long, might it be best to just remove 
the feature? If needed, a new IL name could be added as an explicit 
feature later on, but the current approach of forcing the module name to 
be embedded in output seems flawed.



--- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -199,13 +199,6 @@ bool AsmPrinter::doInitialization(Module &M) {
    // Allow the target to emit any magic that it wants at the start of 
the file.
    EmitStartOfAsmFile(M);

-  // Very minimal debug info. It is ignored if we emit actual debug 
info. If we
-  // don't, this at least helps the user find where a global came from.
-  if (MAI->hasSingleParameterDotFile()) {
-    // .file "foo.c"
-    OutStreamer.EmitFileDirective(M.getModuleIdentifier());
-  }
-
    GCModuleInfo *MI = getAnalysisIfAvailable<GCModuleInfo>();
    assert(MI && "AsmPrinter didn't require GCModuleInfo?");
    for (auto &I : *MI)


-- 
http://www.nuanti.com
the browser experts




More information about the cfe-commits mailing list