<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<p><br>
</p>
<div class="moz-cite-prefix">On 1/24/20 1:05 PM, <a class="moz-txt-link-abbreviated" href="mailto:vsk@apple.com">
vsk@apple.com</a> wrote:<br>
</div>
<blockquote type="cite" cite="mid:2A2D7AED-52B3-418C-AA55-B1D42B709195@apple.com">
+ Kostya<br class="">
<div><br class="">
<blockquote type="cite" class="">
<div class="">On Jan 24, 2020, at 10:56 AM, Phipps, Alan <<a href="mailto:a-phipps@ti.com" class="" moz-do-not-send="true">a-phipps@ti.com</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div class="WordSection1" style="page: WordSection1;
              caret-color: rgb(0, 0, 0); font-family: Helvetica;
              font-size: 14px; font-style: normal; font-variant-caps:
              normal; font-weight: normal; letter-spacing: normal;
              text-align: start; text-indent: 0px; text-transform: none;
              white-space: normal; word-spacing: 0px;
              -webkit-text-stroke-width: 0px; text-decoration: none;">
<div style="margin: 0in 0in 0.0001pt; font-size: 11pt;
                font-family: Calibri, sans-serif;" class="">
<span style="color: rgb(31, 73, 125);" class="">+ Vedant<o:p class=""></o:p></span></div>
<div style="margin: 0in 0in 0.0001pt; font-size: 11pt;
                font-family: Calibri, sans-serif;" class="">
<span style="color: rgb(31, 73, 125);" class=""><o:p class=""> </o:p></span></div>
<div style="margin: 0in 0in 0.0001pt; font-size: 11pt;
                font-family: Calibri, sans-serif;" class="">
<span style="color: rgb(31, 73, 125);" class="">Hi Hal, thanks.<o:p class=""></o:p></span></div>
<div style="margin: 0in 0in 0.0001pt; font-size: 11pt;
                font-family: Calibri, sans-serif;" class="">
<span style="color: rgb(31, 73, 125);" class=""><o:p class=""> </o:p></span></div>
<div style="margin: 0in 0in 0.0001pt; font-size: 11pt;
                font-family: Calibri, sans-serif;" class="">
<span style="color: rgb(31, 73, 125);" class="">I apologize if my answers aren’t as thorough as you would like; what I’m proposing is simply an extension to the existing infrastructure, so it would be enabled automatically as part of code coverage.  Mapping
 of branch regions would be done in CoverageMappingGen and instrumented using the same profiling instrumentation mechanism under CodeGenPGO::mapRegionCounters() and around CodeGenFunction::EmitBranchOnBoolExpr() .  In fact, as I mention below, we’d largely
 be reusing the same profiling counters (except in at least one exception case that I described in my email).  The existing functionality of coverage and profiling would still work exactly as it has.  Further, I can add a switch to llvm-cov to enable/disable
 branch coverage visualization and whether it’s included in the coverage report.<o:p class=""></o:p></span></div>
<div style="margin: 0in 0in 0.0001pt; font-size: 11pt;
                font-family: Calibri, sans-serif;" class="">
<span style="color: rgb(31, 73, 125);" class=""><o:p class=""> </o:p></span></div>
<div style="margin: 0in 0in 0.0001pt; font-size: 11pt;
                font-family: Calibri, sans-serif;" class="">
<span style="color: rgb(31, 73, 125);" class="">With respect to fuzzing, to be sure I don’t misunderstand you, are you referring to testing the branch coverage capability itself using fuzzing, or are you referring to the leveraging of coverage by a fuzzer itself
 (i.e. coverage-guided fuzzing)?  For the latter, I could look into libFuzzer and see how this might impact it.  For the former, I haven’t thought much about using fuzzing to test coverage although I am certainly open to suggestions. </span></div>
</div>
</div>
</blockquote>
<div><br class="">
</div>
<div>To add a bit to this, llvm ships sancov (<a href="https://clang.llvm.org/docs/SanitizerCoverage.html" class="" moz-do-not-send="true">https://clang.llvm.org/docs/SanitizerCoverage.html</a>) to support function/block/edge-level coverage guided fuzzing.
 Alan's proposal targets the 'source-based' coverage feature (<a href="https://clang.llvm.org/docs/SourceBasedCodeCoverage.html" class="" moz-do-not-send="true">https://clang.llvm.org/docs/SourceBasedCodeCoverage.html</a>). The goal of this feature is to provide
 precise, human-readable reports (e.g. without artifacts related to optimized debug info).</div>
<div><br class="">
</div>
<div>As for profiling, llvm+clang support both frontend-level instrumentation (profiles collected this way are meant to degrade slowly over time), and IR-level instrumentation (profiles are tied to the specific revision of the instrumented binary). The source-based
 coverage implementation is built on top of frontend-level PGO instrumentation.</div>
<div><br class="">
</div>
<div>vedant</div>
</div>
</blockquote>
<p><br>
</p>
<p>Thanks for clarifying all of this!</p>
<p> -Hal<br>
</p>
<p><br>
</p>
<blockquote type="cite" cite="mid:2A2D7AED-52B3-418C-AA55-B1D42B709195@apple.com">
<div>
<div><br class="">
</div>
<br class="">
<blockquote type="cite" class="">
<div class="">
<div class="WordSection1" style="page: WordSection1;
              caret-color: rgb(0, 0, 0); font-family: Helvetica;
              font-size: 14px; font-style: normal; font-variant-caps:
              normal; font-weight: normal; letter-spacing: normal;
              text-align: start; text-indent: 0px; text-transform: none;
              white-space: normal; word-spacing: 0px;
              -webkit-text-stroke-width: 0px; text-decoration: none;">
<div style="margin: 0in 0in 0.0001pt; font-size: 11pt;
                font-family: Calibri, sans-serif;" class="">
<span style="color: rgb(31, 73, 125);" class=""><o:p class=""></o:p></span></div>
<div style="margin: 0in 0in 0.0001pt; font-size: 11pt;
                font-family: Calibri, sans-serif;" class="">
<span style="color: rgb(31, 73, 125);" class=""><o:p class=""> </o:p></span></div>
<div style="margin: 0in 0in 0.0001pt; font-size: 11pt;
                font-family: Calibri, sans-serif;" class="">
<span style="color: rgb(31, 73, 125);" class="">-Alan<o:p class=""></o:p></span></div>
<div style="margin: 0in 0in 0.0001pt; font-size: 11pt;
                font-family: Calibri, sans-serif;" class="">
<a name="_MailEndCompose" class="" moz-do-not-send="true"><span style="color: rgb(31, 73, 125);" class=""><o:p class=""> </o:p></span></a></div>
<div class="">
<div style="border-style: solid none none;
                  border-top-width: 1pt; border-top-color: rgb(181, 196,
                  223); padding: 3pt 0in 0in;" class="">
<div style="margin: 0in 0in 0.0001pt; font-size: 11pt;
                    font-family: Calibri, sans-serif;" class="">
<b class=""><span style="font-size: 10pt;
                        font-family: Tahoma, sans-serif;" class="">From:</span></b><span style="font-size: 10pt; font-family: Tahoma,
                      sans-serif;" class=""><span class="Apple-converted-space"> </span>Finkel,
 Hal J. [<a href="mailto:hfinkel@anl.gov" style="color: purple; text-decoration:
                        underline;" class="" moz-do-not-send="true">mailto:hfinkel@anl.gov</a>]<span class="Apple-converted-space"> </span><br class="">
<b class="">Sent:</b><span class="Apple-converted-space"> </span>Friday, January 24, 2020 11:02 AM<br class="">
<b class="">To:</b><span class="Apple-converted-space"> </span>Phipps, Alan;<span class="Apple-converted-space"> </span><a href="mailto:llvm-dev@lists.llvm.org" style="color: purple; text-decoration:
                        underline;" class="" moz-do-not-send="true">llvm-dev@lists.llvm.org</a><br class="">
<b class="">Subject:</b><span class="Apple-converted-space"> </span>[EXTERNAL] Re: [llvm-dev] Adding support for LLVM Branch Condition Coverage<o:p class=""></o:p></span></div>
</div>
</div>
<div style="margin: 0in 0in 0.0001pt; font-size: 11pt;
                font-family: Calibri, sans-serif;" class="">
<o:p class=""> </o:p></div>
<p style="margin-right: 0in; margin-left: 0in; font-size:
                12pt; font-family: "Times New Roman", serif;" class="">
Thanks, Alan. This certainly seems useful. Can you please provide a quick overview on how this relates to our other infrastructure for coverage, for profiling, and what's used for fuzz testing?<o:p class=""></o:p></p>
<p style="margin-right: 0in; margin-left: 0in; font-size:
                12pt; font-family: "Times New Roman", serif;" class="">
 -Hal<o:p class=""></o:p></p>
<div class="">
<div style="margin: 0in 0in 0.0001pt; font-size: 11pt;
                  font-family: Calibri, sans-serif;" class="">
On 1/23/20 6:09 PM, Phipps, Alan via llvm-dev wrote:<o:p class=""></o:p></div>
</div>
<blockquote style="margin-top: 5pt; margin-bottom: 5pt;" class="">
<div style="margin: 0in 0in 0.0001pt; font-size: 11pt;
                  font-family: Calibri, sans-serif;" class="">
Vedant Kumar asked me to post my design thoughts concerning branch coverage at llvm-dev since there is general interest.<o:p class=""></o:p></div>
<div style="margin: 0in 0in 0.0001pt; font-size: 11pt;
                  font-family: Calibri, sans-serif;" class="">
 <o:p class=""></o:p></div>
<div style="margin: 0in 0in 0.0001pt; font-size: 11pt;
                  font-family: Calibri, sans-serif;" class="">
My team at Texas Instruments is developing an embedded ARM C/C++ compiler with LLVM.  I would like to enhance LLVM’s code coverage capability with branch condition coverage (for C/C++), similar to GCC/GCOV support for branch coverage.  This is useful for TI,
 and I think this will be a useful feature enhancement to LLVM that I can upstream. <o:p class=""></o:p></div>
<div style="margin: 0in 0in 0.0001pt; font-size: 11pt;
                  font-family: Calibri, sans-serif;" class="">
 <o:p class=""></o:p></div>
<div style="margin: 0in 0in 0.0001pt; font-size: 11pt;
                  font-family: Calibri, sans-serif;" class="">
In a nutshell, the functionality boils down to tracking how many times a generated “branch” instruction (based on a source code condition) is taken or not taken (i.e. evaluated into “True” and “False”).  This applies to decision points in control flow (if,
 for, while, …) as well as individual conditions on logical operators (“&&”, “||”) in Boolean expressions.<o:p class=""></o:p></div>
<div style="margin: 0in 0in 0.0001pt; font-size: 11pt;
                  font-family: Calibri, sans-serif;" class="">
 <o:p class=""></o:p></div>
<div style="margin: 0in 0in 0.0001pt; font-size: 11pt;
                  font-family: Calibri, sans-serif;" class="">
In sketching out a design, there are three primary areas in the design that I am proposing:<o:p class=""></o:p></div>
<div style="margin: 0in 0in 0.0001pt; font-size: 11pt;
                  font-family: Calibri, sans-serif;" class="">
 <o:p class=""></o:p></div>
<div style="margin: 0in 0in 0.0001pt 0.5in; font-size:
                  11pt; font-family: Calibri, sans-serif; text-indent:
                  -0.25in;" class="">
<span class="">1.)<span style="font-style: normal; font-variant-caps:
                      normal; font-weight: normal; font-stretch: normal;
                      font-size: 7pt; line-height: normal; font-family:
                      "Times New Roman";" class="">   <span class="Apple-converted-space"> </span></span></span><b class="">Add
 a new CounterMappingRegion kind for branch conditions</b><o:p class=""></o:p></div>
<div style="margin: 0in 0in 0.0001pt 1in; font-size:
                  11pt; font-family: Calibri, sans-serif; text-indent:
                  -0.25in;" class="">
<span class="">a.<span style="font-style: normal; font-variant-caps:
                      normal; font-weight: normal; font-stretch: normal;
                      font-size: 7pt; line-height: normal; font-family:
                      "Times New Roman";" class="">     <span class="Apple-converted-space"> </span></span></span>This
 new region kind would track two counters, one for the “True” branch taken count of a branch condition, and one for the “False” branch taken count.<o:p class=""></o:p></div>
<div style="margin: 0in 0in 0.0001pt 1.5in; font-size:
                  11pt; font-family: Calibri, sans-serif; text-indent:
                  -1.5in;" class="">
<span class=""><span style="font-style: normal; font-variant-caps:
                      normal; font-weight: normal; font-stretch: normal;
                      font-size: 7pt; line-height: normal; font-family:
                      "Times New Roman";" class="">                                                                       <span class="Apple-converted-space"> </span></span>i.<span style="font-style: normal; font-variant-caps:
                      normal; font-weight: normal; font-stretch: normal;
                      font-size: 7pt; line-height: normal; font-family:
                      "Times New Roman";" class="">    <span class="Apple-converted-space"> </span></span></span>Alternatively,
 I could use two separate CounterMappingRegions to track individual counters since this is how the class was originally written to be used.  However, using a single region kind to represent a single branch condition that ties all of the pertinent counter information
 together seems like a cleaner design.<o:p class=""></o:p></div>
<div style="margin: 0in 0in 0.0001pt 1.5in; font-size:
                  11pt; font-family: Calibri, sans-serif; text-indent:
                  -1.5in;" class="">
<span class=""><span style="font-style: normal; font-variant-caps:
                      normal; font-weight: normal; font-stretch: normal;
                      font-size: 7pt; line-height: normal; font-family:
                      "Times New Roman";" class="">                                                                      <span class="Apple-converted-space"> </span></span>ii.<span style="font-style: normal; font-variant-caps:
                      normal; font-weight: normal; font-stretch: normal;
                      font-size: 7pt; line-height: normal; font-family:
                      "Times New Roman";" class="">    <span class="Apple-converted-space"> </span></span></span>Just
 as for all counters, the two branch condition counters can represent a reference to an instrumentation counter or to a counter expression.  The two counters are encoded along with the MappingRegions and distinguished based on the region kind.<o:p class=""></o:p></div>
<div style="margin: 0in 0in 0.0001pt 1.5in; font-size:
                  11pt; font-family: Calibri, sans-serif; text-indent:
                  -1.5in;" class="">
<span class=""><span style="font-style: normal; font-variant-caps:
                      normal; font-weight: normal; font-stretch: normal;
                      font-size: 7pt; line-height: normal; font-family:
                      "Times New Roman";" class="">                                                                     <span class="Apple-converted-space"> </span></span>iii.<span style="font-style: normal; font-variant-caps:
                      normal; font-weight: normal; font-stretch: normal;
                      font-size: 7pt; line-height: normal; font-family:
                      "Times New Roman";" class="">    <span class="Apple-converted-space"> </span></span></span>All
 other CounterMappingRegion kinds simply ignore the second counter; nothing changes in how they’re encoded, which preserves format backward compatibility.<o:p class=""></o:p></div>
<div style="margin: 0in 0in 0.0001pt 1in; font-size:
                  11pt; font-family: Calibri, sans-serif; text-indent:
                  -0.25in;" class="">
<span class="">b.<span style="font-style: normal; font-variant-caps:
                      normal; font-weight: normal; font-stretch: normal;
                      font-size: 7pt; line-height: normal; font-family:
                      "Times New Roman";" class="">     <span class="Apple-converted-space"> </span></span></span>I
 think this change also requires an adjustment to the class SourceMappingRegion to support branch conditions that can be generated into CounterMappingRegion instances.<o:p class=""></o:p></div>
<div style="margin: 0in 0in 0.0001pt 0.5in; font-size:
                  11pt; font-family: Calibri, sans-serif;" class="">
 <o:p class=""></o:p></div>
<div style="margin: 0in 0in 0.0001pt 0.5in; font-size:
                  11pt; font-family: Calibri, sans-serif; text-indent:
                  -0.25in;" class="">
<span class="">2.)<span style="font-style: normal; font-variant-caps:
                      normal; font-weight: normal; font-stretch: normal;
                      font-size: 7pt; line-height: normal; font-family:
                      "Times New Roman";" class="">   <span class="Apple-converted-space"> </span></span></span><b class="">Counter
 Instrumentation</b><o:p class=""></o:p></div>
<div style="margin: 0in 0in 0.0001pt 1in; font-size:
                  11pt; font-family: Calibri, sans-serif; text-indent:
                  -0.25in;" class="">
<span class="">a.<span style="font-style: normal; font-variant-caps:
                      normal; font-weight: normal; font-stretch: normal;
                      font-size: 7pt; line-height: normal; font-family:
                      "Times New Roman";" class="">     <span class="Apple-converted-space"> </span></span></span>We
 can reuse most of the existing profile instrumentation counters that are emitted as part of profiling/coverage to calculate branch condition counts (True/False). <o:p class=""></o:p></div>
<div style="margin: 0in 0in 0.0001pt 1.5in; font-size:
                  11pt; font-family: Calibri, sans-serif; text-indent:
                  -1.5in;" class="">
<span class=""><span style="font-style: normal; font-variant-caps:
                      normal; font-weight: normal; font-stretch: normal;
                      font-size: 7pt; line-height: normal; font-family:
                      "Times New Roman";" class="">                                                                       <span class="Apple-converted-space"> </span></span>i.<span style="font-style: normal; font-variant-caps:
                      normal; font-weight: normal; font-stretch: normal;
                      font-size: 7pt; line-height: normal; font-family:
                      "Times New Roman";" class="">    <span class="Apple-converted-space"> </span></span></span>This
 assumption leverages the fact that logical operators<span class="Apple-converted-space"> </span><i class="">in C</i><span class="Apple-converted-space"> </span>are “short-circuit” operators.  For example, the “False-taken” count for the left-hand-side condition
 in a<span class="Apple-converted-space"> </span><i class="">logical-or</i><span class="Apple-converted-space"> </span>expression (e.g. condition “C1” in “C1 || C2”) can be derived from the execution count we already track for the right-hand-side (condition
 “C2” in “C1 || C2”).<o:p class=""></o:p></div>
<div style="margin: 0in 0in 0.0001pt 1in; font-size:
                  11pt; font-family: Calibri, sans-serif; text-indent:
                  -0.25in;" class="">
<span class="">b.<span style="font-style: normal; font-variant-caps:
                      normal; font-weight: normal; font-stretch: normal;
                      font-size: 7pt; line-height: normal; font-family:
                      "Times New Roman";" class="">     <span class="Apple-converted-space"> </span></span></span>There
 does exist a case when evaluating the right-hand-side condition of a logical operator<span class="Apple-converted-space"> </span><i class="">that isn’t part of a control-flow statement</i><span class="Apple-converted-space"> </span>(e.g. condition “C2” in
 “x = C1 || C2;”) that will require instrumenting a new counter in order to properly derive that condition’s “true” count and “false” count.<o:p class=""></o:p></div>
<div style="margin: 0in 0in 0.0001pt 1in; font-size:
                  11pt; font-family: Calibri, sans-serif; text-indent:
                  -0.25in;" class="">
<span class="">c.<span style="font-style: normal; font-variant-caps:
                      normal; font-weight: normal; font-stretch: normal;
                      font-size: 7pt; line-height: normal; font-family:
                      "Times New Roman";" class="">     <span class="Apple-converted-space"> </span></span></span>I’ll
 avoid going too deep into detail here, but my goal is to ensure we reuse existing profile counters as much as possible.<o:p class=""></o:p></div>
<div style="margin: 0in 0in 0.0001pt 1in; font-size:
                  11pt; font-family: Calibri, sans-serif;" class="">
 <o:p class=""></o:p></div>
<div style="margin: 0in 0in 0.0001pt 0.5in; font-size:
                  11pt; font-family: Calibri, sans-serif; text-indent:
                  -0.25in;" class="">
<span class="">3.)<span style="font-style: normal; font-variant-caps:
                      normal; font-weight: normal; font-stretch: normal;
                      font-size: 7pt; line-height: normal; font-family:
                      "Times New Roman";" class="">   <span class="Apple-converted-space"> </span></span></span><b class="">Visualization
 using llvm-cov</b><o:p class=""></o:p></div>
<div style="margin: 0in 0in 0.0001pt 1in; font-size:
                  11pt; font-family: Calibri, sans-serif; text-indent:
                  -0.25in;" class="">
<span class="">a.<span style="font-style: normal; font-variant-caps:
                      normal; font-weight: normal; font-stretch: normal;
                      font-size: 7pt; line-height: normal; font-family:
                      "Times New Roman";" class="">     <span class="Apple-converted-space"> </span></span></span>The
 notion of CoverageSegment needs to be extended to comprehend the branch condition data represented by a CounterMappingRegion above.  But then llvm-cov can treat the segment distinctly when displaying True/False counts for each branch condition as well as tracking
 total missed branches.<o:p class=""></o:p></div>
<div style="margin: 0in 0in 0.0001pt 1in; font-size:
                  11pt; font-family: Calibri, sans-serif; text-indent:
                  -0.25in;" class="">
<span class="">b.<span style="font-style: normal; font-variant-caps:
                      normal; font-weight: normal; font-stretch: normal;
                      font-size: 7pt; line-height: normal; font-family:
                      "Times New Roman";" class="">     <span class="Apple-converted-space"> </span></span></span>We
 can also add a BranchCoverageInfo class to track branch coverage data, similar to LineCoverageInfo and RegionCoverageInfo.<o:p class=""></o:p></div>
<div style="margin: 0in 0in 0.0001pt 1in; font-size:
                  11pt; font-family: Calibri, sans-serif; text-indent:
                  -0.25in;" class="">
<span class="">c.<span style="font-style: normal; font-variant-caps:
                      normal; font-weight: normal; font-stretch: normal;
                      font-size: 7pt; line-height: normal; font-family:
                      "Times New Roman";" class="">     <span class="Apple-converted-space"> </span></span></span>The
 text output could look something like GCOV but with more detail that we know (I prototyped this using logical-or):<o:p class=""></o:p></div>
<div style="margin: 0in 0in 0.0001pt; font-size: 11pt;
                  font-family: Calibri, sans-serif;" class="">
 <o:p class=""></o:p></div>
<div style="margin: 0in 0in 0.0001pt 1.5in; font-size:
                  11pt; font-family: Calibri, sans-serif;" class="">
<span style="font-size: 10pt; font-family: Consolas;" class="">    9|       |int main(int argc, char *argv[])</span><o:p class=""></o:p></div>
<div style="margin: 0in 0in 0.0001pt 1.5in; font-size:
                  11pt; font-family: Calibri, sans-serif;" class="">
<span style="font-size: 10pt; font-family: Consolas;" class="">   10|      3|{</span><o:p class=""></o:p></div>
<div style="margin: 0in 0in 0.0001pt 1.5in; font-size:
                  11pt; font-family: Calibri, sans-serif;" class="">
<span style="font-size: 10pt; font-family: Consolas;" class="">   11|      3|    if (argc == 1)</span><o:p class=""></o:p></div>
<div style="margin: 0in 0in 0.0001pt 1.5in; font-size:
                  11pt; font-family: Calibri, sans-serif;" class="">
<b class=""><span style="font-size: 10pt; font-family:
                      Consolas;" class="">Branch (11:9): [True: 1, False: 2]</span></b><o:p class=""></o:p></div>
<div style="margin: 0in 0in 0.0001pt 1.5in; font-size:
                  11pt; font-family: Calibri, sans-serif;" class="">
<span style="font-size: 10pt; font-family: Consolas;" class="">   12|      1|    {</span><o:p class=""></o:p></div>
<div style="margin: 0in 0in 0.0001pt 1.5in; font-size:
                  11pt; font-family: Calibri, sans-serif;" class="">
<span style="font-size: 10pt; font-family: Consolas;" class="">   13|      1|        return 0;</span><o:p class=""></o:p></div>
<div style="margin: 0in 0in 0.0001pt 1.5in; font-size:
                  11pt; font-family: Calibri, sans-serif;" class="">
<span style="font-size: 10pt; font-family: Consolas;" class="">   14|      1|    }</span><o:p class=""></o:p></div>
<div style="margin: 0in 0in 0.0001pt 1.5in; font-size:
                  11pt; font-family: Calibri, sans-serif; text-indent:
                  0.5in;" class="">
<span style="font-size: 10pt;
                    font-family: Consolas;" class="">. . .</span><o:p class=""></o:p></div>
<div style="margin: 0in 0in 0.0001pt 1.5in; font-size:
                  11pt; font-family: Calibri, sans-serif;" class="">
<span style="font-size: 10pt; font-family: Consolas;" class=""> </span><o:p class=""></o:p></div>
<div style="margin: 0in 0in 0.0001pt 1.5in; font-size:
                  11pt; font-family: Calibri, sans-serif;" class="">
<span style="font-size: 10pt; font-family: Consolas;" class="">  23|      2|    if (a == 0 || b == 2 || b == 34 || a == b)</span><o:p class=""></o:p></div>
<div style="margin: 0in 0in 0.0001pt 1.5in; font-size:
                  11pt; font-family: Calibri, sans-serif;" class="">
<b class=""><span style="font-size: 10pt; font-family:
                      Consolas;" class="">Branch (23:9):  [True: 1, False: 1]</span></b><o:p class=""></o:p></div>
<div style="margin: 0in 0in 0.0001pt 1.5in; font-size:
                  11pt; font-family: Calibri, sans-serif;" class="">
<b class=""><span style="font-size: 10pt; font-family:
                      Consolas;" class="">Branch (23:19): [True: 1, False: 0]</span></b><o:p class=""></o:p></div>
<div style="margin: 0in 0in 0.0001pt 1.5in; font-size:
                  11pt; font-family: Calibri, sans-serif;" class="">
<b class=""><span style="font-size: 10pt; font-family:
                      Consolas;" class="">Branch (23:29): [True: 0, False: 0]</span></b><o:p class=""></o:p></div>
<div style="margin: 0in 0in 0.0001pt 1.5in; font-size:
                  11pt; font-family: Calibri, sans-serif;" class="">
<b class=""><span style="font-size: 10pt; font-family:
                      Consolas;" class="">Branch (23:40): [True: 0, False: 0]</span></b><o:p class=""></o:p></div>
<div style="margin: 0in 0in 0.0001pt 1.5in; font-size:
                  11pt; font-family: Calibri, sans-serif; text-indent:
                  0.5in;" class="">
<span style="font-size: 10pt;
                    font-family: Consolas;" class="">. . .</span><o:p class=""></o:p></div>
<div style="margin: 0in 0in 0.0001pt 1.5in; font-size:
                  11pt; font-family: Calibri, sans-serif;" class="">
<span style="font-size: 10pt; font-family: Consolas;" class=""> </span><o:p class=""></o:p></div>
<div style="margin: 0in 0in 0.0001pt 1.5in; font-size:
                  11pt; font-family: Calibri, sans-serif;" class="">
<span style="font-size: 10pt; font-family: Consolas;" class="">  31|      2|    b = a || c;  </span><o:p class=""></o:p></div>
<div style="margin: 0in 0in 0.0001pt 1.5in; font-size:
                  11pt; font-family: Calibri, sans-serif;" class="">
<b class=""><span style="font-size: 10pt; font-family:
                      Consolas;" class="">Branch (31:9):  [True: 1, False: 1]</span></b><o:p class=""></o:p></div>
<div style="margin: 0in 0in 0.0001pt 1.5in; font-size:
                  11pt; font-family: Calibri, sans-serif;" class="">
<b class=""><span style="font-size: 10pt; font-family:
                      Consolas;" class="">Branch (31:14): [True: 1, False: 0]</span></b><o:p class=""></o:p></div>
<div style="margin: 0in 0in 0.0001pt; font-size: 11pt;
                  font-family: Calibri, sans-serif;" class="">
 <o:p class=""></o:p></div>
<div style="margin: 0in 0in 0.0001pt 1in; font-size:
                  11pt; font-family: Calibri, sans-serif; text-indent:
                  -0.25in;" class="">
<span class="">d.<span style="font-style: normal; font-variant-caps:
                      normal; font-weight: normal; font-stretch: normal;
                      font-size: 7pt; line-height: normal; font-family:
                      "Times New Roman";" class="">     <span class="Apple-converted-space"> </span></span></span>I
 thought about extending the “region-count” carat markers in the text display, but it could get messy.  For the HTML output, we can get a bit more fancy.<o:p class=""></o:p></div>
<div style="margin: 0in 0in 0.0001pt 1in; font-size:
                  11pt; font-family: Calibri, sans-serif; text-indent:
                  -0.25in;" class="">
<span class="">e.<span style="font-style: normal; font-variant-caps:
                      normal; font-weight: normal; font-stretch: normal;
                      font-size: 7pt; line-height: normal; font-family:
                      "Times New Roman";" class="">     <span class="Apple-converted-space"> </span></span></span>Branch
 miss percentages/totals will be added to the coverage report.<o:p class=""></o:p></div>
<div style="margin: 0in 0in 0.0001pt 1in; font-size:
                  11pt; font-family: Calibri, sans-serif;" class="">
 <o:p class=""></o:p></div>
<div style="margin: 0in 0in 0.0001pt; font-size: 11pt;
                  font-family: Calibri, sans-serif;" class="">
<b class="">Additional Notes</b><o:p class=""></o:p></div>
<div style="margin: 0in 0in 0.0001pt 0.5in; font-size:
                  11pt; font-family: Calibri, sans-serif; text-indent:
                  -0.25in;" class="">
<span class="">-<span style="font-style: normal; font-variant-caps:
                      normal; font-weight: normal; font-stretch: normal;
                      font-size: 7pt; line-height: normal; font-family:
                      "Times New Roman";" class="">       <span class="Apple-converted-space"> </span></span></span>I’m
 aware that constant condition folding in CodeGenFunction::EmitBranchOnBoolExpr() needs to be taken into account.  Is there anything else related to branch optimization that I ought to be aware of?<o:p class=""></o:p></div>
<div style="margin: 0in 0in 0.0001pt 0.5in; font-size:
                  11pt; font-family: Calibri, sans-serif;" class="">
<b class=""> </b><o:p class=""></o:p></div>
<div style="margin: 0in 0in 0.0001pt; font-size: 11pt;
                  font-family: Calibri, sans-serif;" class="">
 <o:p class=""></o:p></div>
<div style="margin: 0in 0in 0.0001pt; font-size: 11pt;
                  font-family: Calibri, sans-serif;" class="">
Please let me know if these design thoughts look reasonable and if this would be useful.  The goal is to start full implementation soon and upstream in a few months.<o:p class=""></o:p></div>
<div style="margin: 0in 0in 0.0001pt; font-size: 11pt;
                  font-family: Calibri, sans-serif;" class="">
 <o:p class=""></o:p></div>
<div style="margin: 0in 0in 0.0001pt; font-size: 11pt;
                  font-family: Calibri, sans-serif;" class="">
Thanks!<o:p class=""></o:p></div>
<div style="margin: 0in 0in 0.0001pt; font-size: 11pt;
                  font-family: Calibri, sans-serif;" class="">
Alan Phipps<o:p class=""></o:p></div>
<div style="margin: 0in 0in 0.0001pt; font-size: 11pt;
                  font-family: Calibri, sans-serif;" class="">
Texas Instruments, Inc.<o:p class=""></o:p></div>
<div style="margin: 0in 0in 0.0001pt; font-size: 11pt;
                  font-family: Calibri, sans-serif;" class="">
 <o:p class=""></o:p></div>
<div style="margin: 0in 0in 0.0001pt; font-size: 11pt;
                  font-family: Calibri, sans-serif;" class="">
<span style="font-size: 12pt; font-family: "Times New
                    Roman", serif;" class=""><br class="">
<br class="">
<o:p class=""></o:p></span></div>
<pre style="margin: 0in 0in 0.0001pt; font-size: 10pt; font-family: "Courier New";" class="">_______________________________________________<o:p class=""></o:p></pre>
<pre style="margin: 0in 0in 0.0001pt; font-size: 10pt; font-family: "Courier New";" class="">LLVM Developers mailing list<o:p class=""></o:p></pre>
<pre style="margin: 0in 0in 0.0001pt; font-size: 10pt; font-family: "Courier New";" class=""><a href="mailto:llvm-dev@lists.llvm.org" style="color: purple; text-decoration: underline;" class="" moz-do-not-send="true">llvm-dev@lists.llvm.org</a><o:p class=""></o:p></pre>
<pre style="margin: 0in 0in 0.0001pt; font-size: 10pt; font-family: "Courier New";" class=""><a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" style="color: purple; text-decoration: underline;" class="" moz-do-not-send="true">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><o:p class=""></o:p></pre>
</blockquote>
<pre style="margin: 0in 0in 0.0001pt; font-size: 10pt; font-family: "Courier New";" class="">-- <o:p class=""></o:p></pre>
<pre style="margin: 0in 0in 0.0001pt; font-size: 10pt; font-family: "Courier New";" class="">Hal Finkel<o:p class=""></o:p></pre>
<pre style="margin: 0in 0in 0.0001pt; font-size: 10pt; font-family: "Courier New";" class="">Lead, Compiler Technology and Programming Languages<o:p class=""></o:p></pre>
<pre style="margin: 0in 0in 0.0001pt; font-size: 10pt; font-family: "Courier New";" class="">Leadership Computing Facility<o:p class=""></o:p></pre>
<pre style="margin: 0in 0in 0.0001pt; font-size: 10pt; font-family: "Courier New";" class="">Argonne National Laboratory</pre>
</div>
</div>
</blockquote>
</div>
<br class="">
</blockquote>
<pre class="moz-signature" cols="72">-- 
Hal Finkel
Lead, Compiler Technology and Programming Languages
Leadership Computing Facility
Argonne National Laboratory</pre>
</body>
</html>