<div dir="ltr"><div>One problem I see with the IR verifier's output is that it does not display the functon(s) in which the error occurs.</div><div><br></div><div>A common error on my part is to reference a value generated in one function, from a different function.  (This may seem strange, but it can happen because I cache the LLVM value of evaluating an expression in some required circumstances, and I need to explicitly purge this cached value if I know that I need to evaluate an expression in two different contexts.)  When this happens I need to grep the IR to try to figure out which functions are involved.</div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jun 13, 2019 at 8:09 AM Tim Northover via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Norbert,<br>
<br>
On Wed, 12 Jun 2019 at 23:53, Winter Claus via llvm-dev<br>
<<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br>
> Currently I am using IRBuilder to create a module, and I encountered an error, which I cannot trace back to the IRBuilder related call, which caused the error:<br>
> "Instruction does not dominate all uses!<br>
> %14 = load i32, i32* @r6<br>
> %11 = trunc i32 %14 to i8<br>
> LLVM ERROR: Broken function found, compilation aborted!"<br>
><br>
> This description is too losely specified for me to know, where the causing code is located. Getting 20 lines instead of 2 would help. Getting additional info of the broken function could also help. How can this be solved?<br>
<br>
This looks like an error in the Verifier. I often find them a bit<br>
terse too, but I don't think there's a command-line option to<br>
automatically be more verbose on an error. I tend to set a breakpoint<br>
in "CheckFailed" and go up a few stack levels. That usually lets you<br>
dump the function or module that's causing problems.<br>
<br>
Alternatively, you might dump your functions just after creating them<br>
and look for truncs & loads with those operands.<br>
<br>
Cheers.<br>
<br>
Tim.<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div>