r198640 - CodeGen: Initial instrumentation based PGO implementation
Chris Lattner
clattner at apple.com
Tue Jan 14 22:26:50 PST 2014
On Jan 14, 2014, at 9:58 PM, Justin Bogner <mail at justinbogner.com> wrote:
> Chris Lattner <sabre at nondot.org> writes:
>>>>> - // If the body of the case is just a 'break', and if there was no
>>>>> fallthrough,
>>>>> - // try to not emit an empty block.
>>>>> - if ((CGM.getCodeGenOpts().OptimizationLevel > 0) &&
>>>>> + // If the body of the case is just a 'break', try to not emit an empty
>>>>> block.
>>>>> + // If we're profiling or we're not optimizing, leave the block in for
>>>>> better
>>>>> + // debug and coverage analysis.
>>>>> + if (!CGM.getCodeGenOpts().ProfileInstrGenerate &&
>>>>> + CGM.getCodeGenOpts().OptimizationLevel > 0 &&
>>>>> isa<BreakStmt>(S.getSubStmt())) {
>>>>> JumpDest Block = BreakContinueStack.back().BreakBlock;
>>
>> I don't like clang generating dead code. This isn't good for -O0
>> compile time because nothing removes them, and we get unnecessarily
>> slow and bloated debug mode code. However, if we need to drop a
>> profiling counter in a block, that seems like a good reason to emit
>> it. Do we really need to do this though? If the block would be
>> elided by -O0 code, why do we care about its count?
>
> In this particular case, we didn't elide the block at -O0 anyway. It's
> only skipped if optimizations are on, which seems kind of silly since
> the backend will remove it for us.
Ok, I don't have any objection to keeping the block then.
-Chris
More information about the cfe-commits
mailing list