[PATCH] D72425: [OptRemark] RFC: Introduce a message table for OptRemarks

Andy Kaylor via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 8 16:05:45 PST 2020


andrew.w.kaylor created this revision.
andrew.w.kaylor added reviewers: thegameg, anemet, hfinkel, karthiksenthil.
Herald added subscribers: llvm-commits, mgorny.
Herald added a project: LLVM.

This is a very preliminary proposal to introduce a message table that would let us replace hard-coded strings with an identifier. The basic idea is that instead of something like this:

  ORE->emit([&]() {
    return OptimizationRemark(DEBUG_TYPE, "LoadElim", LI)
           << "load of type " << NV("Type", LI->getType()) << " eliminated"
           << setExtraArgs() << " in favor of "
           << NV("InfavorOfValue", AvailableValue);
  });

We'd be able to have something like this:

  ORE->emit([&]() {
    return OptimizationRemark(DEBUG_TYPE, diag::remark_gvn_load_elim, LI)
           << NV("Type", LI->getType())
           << setExtraArgs() << NV("InfavorOfValue", AvailableValue);
  });

I think this opens up a lot of possibilities for more compact storage of remarks and more reliable identification of remarks in the DiagHandler. It also brings up a lot of questions about how much of the information that is currently part of the OptimizationRemark class (and its siblings) should be part of the message table. I hope to discuss that in this review.


https://reviews.llvm.org/D72425

Files:
  llvm/test/TableGen/opt-remark-diag.td
  llvm/utils/TableGen/CMakeLists.txt
  llvm/utils/TableGen/OptRemarkDiagEmitter.cpp
  llvm/utils/TableGen/TableGen.cpp
  llvm/utils/TableGen/TableGenBackends.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D72425.236926.patch
Type: text/x-patch
Size: 4797 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200109/0e90dec3/attachment.bin>


More information about the llvm-commits mailing list