<html>
<head>
<base href="http://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - Optimization remarks are "always on" in LTO"
href="http://llvm.org/bugs/show_bug.cgi?id=21108">21108</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Optimization remarks are "always on" in LTO
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Interprocedural Optimizations
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>dexonsmith@apple.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>r206400 and r209442 added support to diagnostic handlers to check for
optimization remarks. However, this support wasn't pulled through to
`LTOCodeGenerator:: DiagnosticHandler2()`, so anyone using libLTO gets this
remarks by default.
The logic in `LLVMContext::diagnose()` looks like this:
// If there is a report handler, use it.
if (pImpl->DiagnosticHandler) {
pImpl->DiagnosticHandler(DI, pImpl->DiagnosticContext);
return;
}
// Optimization remarks are selective. They need to check whether the
regexp
// pattern, passed via one of the -pass-remarks* flags, matches the name of
// the pass that is emitting the diagnostic. If there is no match, ignore
the
// diagnostic and return.
switch (DI.getKind()) {
case llvm::DK_OptimizationRemark:
if (!cast<DiagnosticInfoOptimizationRemark>(DI).isEnabled())
return;
break;
case llvm::DK_OptimizationRemarkMissed:
if (!cast<DiagnosticInfoOptimizationRemarkMissed>(DI).isEnabled())
return;
break;
case llvm::DK_OptimizationRemarkAnalysis:
if (!cast<DiagnosticInfoOptimizationRemarkAnalysis>(DI).isEnabled())
return;
break;
default:
break;
}
The wrong fix is to move the `switch` before the call out to the handler. This
would fix LTO, but break clang.
Two other fixes come to mind:
1. Duplicate the switch statement in `LTOCodeGenerator::DiagnosticHandler2()`.
I don't like this.
2. Change `LLVMContext::DiagnosticHandlerTy` to take an extra `bool`
parameter, which indicates whether the backend suggests this should be
"ignored" (would the `switch` return early?). `clang` can use its own logic;
`LTOCodeGenerator` can use the parameter.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>