This is an archive of the discontinued LLVM Phabricator instance.

[Remarks] Emit a section containing remark diagnostics metadata
ClosedPublic

Authored by thegameg on Mar 19 2019, 5:40 PM.

Details

Summary

A section containing metadata on remark diagnostics will be emitted if the flag (-mllvm) -remarks-section is present.

For now, the metadata is:

  • a magic number for remarks: "REMARKS\0"
  • the version number: a little-endian uint64_t
  • the absolute file path to the serialized remark diagnostics: a null-terminated string

Diff Detail

Repository
rL LLVM

Event Timeline

thegameg created this revision.Mar 19 2019, 5:40 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 19 2019, 5:40 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
JDevlieghere requested changes to this revision.Mar 19 2019, 6:04 PM

This needs a test.

This revision now requires changes to proceed.Mar 19 2019, 6:04 PM
thegameg updated this revision to Diff 191428.Mar 19 2019, 6:31 PM

Forgot to add it to the diff.

ormris added inline comments.Mar 20 2019, 9:40 AM
llvm/test/CodeGen/X86/remarks-section.ll
2 ↗(On Diff #191428)

Quick drive-by nit: I noticed that this uses "/dev/null". This will cause failures on the Windows bots, since Windows doesn't provide that file.

thegameg marked an inline comment as done.Mar 20 2019, 9:55 AM
thegameg added inline comments.
llvm/test/CodeGen/X86/remarks-section.ll
2 ↗(On Diff #191428)

Thanks for the heads-up. What would be the solution to this? Is this any different from all the other tests using -o /dev/null or > /dev/null?

ormris added inline comments.Mar 20 2019, 10:23 AM
llvm/test/CodeGen/X86/remarks-section.ll
2 ↗(On Diff #191428)

Yes, since you're checking for the final path. Lit will replace the string "/dev/null" with a temporary file. You could use a RUN line like this:

; RUN: llc < %s -mtriple=x86_64-linux -remarks-section -pass-remarks-output=%/t.yaml | FileCheck -DPATH=%/t.yaml %s

That will store the path of the remarks file in the Filecheck variable "PATH", which you can refer to in your CHECK lines as "[[PATH]]". The "%/t" variable is also really handy. It makes sure that the path will always use forward slashes, removing backslash weirdness.

thegameg updated this revision to Diff 191546.Mar 20 2019, 11:31 AM

Update test to use a real path instead of /dev/null. Thanks @ormris, I didn't know lit could do all that!

ormris added inline comments.Mar 20 2019, 11:35 AM
llvm/test/CodeGen/X86/remarks-section.ll
2 ↗(On Diff #191428)

LG!

ormris removed a subscriber: ormris.Mar 20 2019, 11:39 AM
JDevlieghere accepted this revision.Mar 26 2019, 5:50 PM

LGTM, apologies about the delay!

This revision is now accepted and ready to land.Mar 26 2019, 5:50 PM
This revision was automatically updated to reflect the committed changes.