<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">On 7/15/14, 9:55 AM, William Moses
wrote:<br>
</div>
<blockquote
cite="mid:CAGPZhf0YLGi+ueSN=dCWcpfgd3Vwodc0VQdbg55kJme1ggT_Vg@mail.gmail.com"
type="cite">
<div dir="ltr">All,
<div><br>
</div>
<div>Consider the case where the entry block to a function acts
like a loop (e.g. it ends with a conditional break to itself
and somewhere else). How would one create a PHINode
(representing an index perhaps) which has a constant index
(say 0) when entering the function, and (oldval+1) when
looping.</div>
<div><br>
</div>
<div>I understand how to do this if the loop were not in the
entry block (by simply using
node->addIncoming(ConstantInt(...), entry),
node->addIncoming(builder.CreateAdd(node,...),loopBlock) ).</div>
<div>
<br>
</div>
<div>My question is how would one do this using the C++ API when
there is no predecessor since it is the entry block.</div>
</div>
</blockquote>
<br>
An entry block cannot have any phi-nodes. If you have a function
that starts with a loop, then your entry block will be a single
unconditional branch to a basic block which is the first basic block
of the loop.<br>
<br>
Regards,<br>
<br>
John Criswell<br>
<br>
<blockquote
cite="mid:CAGPZhf0YLGi+ueSN=dCWcpfgd3Vwodc0VQdbg55kJme1ggT_Vg@mail.gmail.com"
type="cite">
<div dir="ltr">
<div><br>
</div>
<div>Thanks,</div>
<div>Billy Moses</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
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>