<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
On 5/2/11 11:59 AM, Chuck Zhao wrote:
<blockquote cite="mid:4DBEE2F0.5070107@eecg.toronto.edu" type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<font size="+1">I am having difficulty in replicating </font><font
size="+1">a sequence of instructions (2+, with def-use
dependencies within) </font><font size="+1">and inserting them
at a different location.<br>
<br>
I have tried a few different approaches (IRBuilder, new
Instruction(), I->clone(), insertBefore/insertAfter,etc.),
all leading to the same error msg:<br>
<big>"Instruction doesn't dominate all uses"</big><br>
</font></blockquote>
<br>
In LLVM IR, an instruction must dominate all of its uses. What this
means is that an instruction must be inserted into a basic block
that dominates the basic blocks of all instructions that use the
inserted instruction's result. In other words, it must be the case
that the inserted instruction is always executed once before any
instruction that uses its result.<br>
<br>
I'm not sure what you are doing wrong that is causing the above
problem to occur. It might be that you're not adjusting the def-use
chains after replication or you might be inserting instructions in
the wrong order in a basic block (defs must come before uses).<br>
<br>
The above error comes from the verifier pass, so you can disable the
verifier pass, save the bitcode, and disassemble it to see what IR
you're building that is incorrect. Alternatively, you can have your
transform dump the new instructions to stdout or stderr to see what
IR it is generating.<br>
<br>
-- John T.<br>
<br>
<blockquote cite="mid:4DBEE2F0.5070107@eecg.toronto.edu" type="cite"><font
size="+1"> <br>
The DevList has a few previous discussions on this, but not much
of hints I can get from there.<br>
<br>
Could somebody point me a code template or an existing LLVM
source file that does similar things?<br>
<br>
<br>
Thank you very much<br>
<br>
Chuck<br>
<br>
<br>
</font>
<pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
LLVM Developers mailing list
<a class="moz-txt-link-abbreviated" href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a> <a class="moz-txt-link-freetext" href="http://llvm.cs.uiuc.edu">http://llvm.cs.uiuc.edu</a>
<a class="moz-txt-link-freetext" href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a>
</pre>
</blockquote>
<br>
</body>
</html>