<div dir="ltr">Hi Tim:<div><br></div><div>Actually, after thinking about it a bit more, I really can't exclude the default case even if it is implicit.  If the block after the switch is never covered, and doesn't have an unreachable instruction, I should really try to cover it as well.</div><div><br></div><div>As always, explaining the problem helped.</div><div><br></div><div>thanks again...</div><div>don</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Nov 15, 2016 at 8:35 AM, don hinton <span dir="ltr"><<a href="mailto:hintonda@gmail.com" target="_blank">hintonda@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Tim:<div><br></div><div>That's essentially what I came up with too, but was hoping there might be an existing analysis pass that could be helpful.</div><div><br></div><div>I'm writing a tool that can inject faults at runtime to increase code coverage, e.g, based on gcov results.  It supports branch (if only) and switch instructions, but currently ignores branches associated with loops, though I hope to add some support for non-range based loops at some point.</div><div><br></div><div>If I could determine that the default case is implicit, I could ignore it at compile time.  Otherwise, it's included in the list of candidates and only gets excluded at runtime based on coverage.  Also, determining the correct fault value to inject for the default case must be calculated, which isn't as easy as using ICmpInst::<wbr>makeConstantRange for if branches.</div><div><br></div><div>thanks...</div><span class="HOEnZb"><font color="#888888"><div>don</div><div><br></div><div><br></div><div><br></div><div><br></div></font></span></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Nov 15, 2016 at 7:35 AM, Tim Northover <span dir="ltr"><<a href="mailto:t.p.northover@gmail.com" target="_blank">t.p.northover@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Don,<br>
<br>
On 14 November 2016 at 19:00, don hinton via llvm-dev<br>
<span><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br>
> Since a SwitchInst always has a default case even if no default case<br>
> appeared in the code, what's the best way to determine if it's explicit or<br>
> implicit?<br>
<br>
</span>You'd have to examine Clang's AST for that information, it's not<br>
present once the LLVM IR has been emitted.<br>
<br>
What are you actually trying to do that makes you think you need that<br>
information? There might be an alternative approach.<br>
<br>
Cheers.<br>
<span class="m_2635582899795793550HOEnZb"><font color="#888888"><br>
Tim.<br>
</font></span></blockquote></div><br></div>
</div></div></blockquote></div><br></div>