<div dir="ltr">Thanks Tim,<div><br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span class=""><br>
On 5 October 2014 13:47, XiaoGuang Wang <<a href="mailto:xjtuwxg@gmail.com">xjtuwxg@gmail.com</a>> wrote:<br>
> So what's going on with my test. Is there something I did wrong with<br>
> jumptable options? Or is the jumptable tried to address other problem, not<br>
> indirect call?<br>
<br>
</span>I think LLVM's jump table pass requires explicit function annotations<br>
in the IR for functions that should go via the table, which Clang<br>
doesn't create. Something like this in its simplest form:<br>
<br>
define void @foo() unnamed_addr jumptable {<br>
  ret void<br>
}<br>
<br>
define void @main() {<br>
  %var = alloca void()*<br>
  store void()* @foo, void()** %var<br>
  %func = load void()** %var<br>
  call void %func()<br>
  ret void<br>
}<br></blockquote><div><br></div><div> You're right. It seems we need to manually annotate the IR function in this case. I just found a clang patch which Tom Roeder provided (<a href="http://comments.gmane.org/gmane.comp.compilers.clang.scm/102395">http://comments.gmane.org/gmane.comp.compilers.clang.scm/102395</a>). And I tried it, it works with clang -ffcif test.c.</div><div><br></div><div>I'm trying to read source code to see how jump table pass works.</div><div><br></div><div>Thanks again!</div><div><br></div><div>Xiaoguang</div></div></div></div></div>