This is an archive of the discontinued LLVM Phabricator instance.

[ORE] Add diagnostics hotness threshold
ClosedPublic

Authored by modocache on Jun 29 2017, 11:35 PM.

Details

Summary

Add an option to prevent diagnostics that do not meet a minimum hotness
threshold from being output. When generating optimization remarks for
large codebases with a ton of cold code paths, this option can be used
to limit the optimization remark output at a reasonable size. Discussion of
this change can be read here:
http://lists.llvm.org/pipermail/llvm-dev/2017-June/114377.html

Event Timeline

modocache created this revision.Jun 29 2017, 11:35 PM
anemet edited edge metadata.

Great!

include/llvm/IR/LLVMContext.h
196–199

What's the difference between None and 0?

lib/Analysis/OptimizationDiagnosticInfo.cpp
166–172

You need to add the same code to MachineOptimizationRemarkEmitter::emit() too.

modocache added inline comments.Jun 30 2017, 11:53 AM
include/llvm/IR/LLVMContext.h
196–199

I had originally thought that there should be a distinction between "the threshold has been set to zero" and "the threshold has not been set", but taking another look at this patch and the one to Clang, I realize there isn't a need for it. I'll remove the Optional<> here, good call!

lib/Analysis/OptimizationDiagnosticInfo.cpp
166–172

Oh, good catch, thank you! Do you know if there's an existing test for MachineOptimizationRemarkEmitter?

anemet added inline comments.Jun 30 2017, 12:29 PM
lib/Analysis/OptimizationDiagnosticInfo.cpp
166–172

There are a few, look for pass-remarks under test/CodeGen. The one I originally added is test/CodeGen/AArch64/arm64-spill-remarks.ll.

modocache updated this revision to Diff 104920.Jun 30 2017, 1:26 PM

Add hotness threshold check to MachineOptimizationRemarkEmitter, and change the threshold attribute type for LLVMContext from an optional unsigned to just an unsigned.

modocache updated this revision to Diff 104940.Jun 30 2017, 2:53 PM

Add tests for the MachineOptimizationRemarkEmitter codepath, to test/CodeGen/AArch64/arm64-spill-remarks.ll.

modocache marked 5 inline comments as done.Jun 30 2017, 2:54 PM
anemet accepted this revision.Jun 30 2017, 3:05 PM

LGTM now, thanks!

This revision is now accepted and ready to land.Jun 30 2017, 3:05 PM
modocache closed this revision.Jun 30 2017, 4:15 PM

Great, thank you!