<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/23/12 7:04 PM, Edvard Ghazaryan
wrote:<br>
</div>
<blockquote
cite="mid:1343088243.55485.YahooMailNeo@web121803.mail.ne1.yahoo.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<div style="color:#000; background-color:#fff; font-family:times
new roman, new york, times, serif;font-size:12pt">
<div><br>
</div>
<div style="font-family: 'times new roman', 'new york', times,
serif; font-size: 12pt; ">
<div style="font-family: 'times new roman', 'new york', times,
serif; font-size: 12pt; ">
<div id="yiv1581066733">
<div style="color: rgb(0, 0, 0); background-color:
rgb(255, 255, 255); font-family: 'times new roman', 'new
york', times, serif; font-size: 12pt; ">
<div style="font-family: times, serif; font-size: 12pt;
"><br>
</div>
<div style="font-family: times, serif; ">
<div style="font-family: times, serif; ">
<div id="yiv1581066733">
<div style="background-color: rgb(255, 255, 255);
font-family: times, serif; ">
<div style="color: rgb(0, 0, 0); font-family:
times, serif; font-size: 12pt; ">Hello .</div>
<div style="font-family: times, serif; ">
<div
class="yiv1581066733yui_3_2_0_20_134301829836475"><br>
</div>
</div>
<div style="color: rgb(0, 0, 0); font-family:
times, serif; font-size: 12pt; "
class="yiv1581066733yui_3_2_0_20_134301829836475">I'm
trying to implement FunctionPass for detecting
loops in llvm IR.</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
<br>
I think the LoopInfo analysis already locates loops.<br>
<br>
<blockquote
cite="mid:1343088243.55485.YahooMailNeo@web121803.mail.ne1.yahoo.com"
type="cite">
<div style="color:#000; background-color:#fff; font-family:times
new roman, new york, times, serif;font-size:12pt">
<div style="font-family: 'times new roman', 'new york', times,
serif; font-size: 12pt; ">
<div style="font-family: 'times new roman', 'new york', times,
serif; font-size: 12pt; ">
<div id="yiv1581066733">
<div style="color: rgb(0, 0, 0); background-color:
rgb(255, 255, 255); font-family: 'times new roman', 'new
york', times, serif; font-size: 12pt; ">
<div style="font-family: times, serif; ">
<div style="font-family: times, serif; ">
<div id="yiv1581066733">
<div style="background-color: rgb(255, 255, 255);
font-family: times, serif; ">
<div style="color:rgb(0, 0,
0);font-family:times, serif;font-size:12pt;"
class="yiv1581066733yui_3_2_0_20_134301829836475
yui_3_2_0_19_134308788264589">How can I get
<condition> for loop from llvm::Loop
object.?</div>
<div style="color:rgb(0, 0,
0);font-family:times, serif;font-size:12pt;"
class="yiv1581066733yui_3_2_0_20_134301829836475
yui_3_2_0_19_134308788264589">Is there any
example?</div>
<div style="color: rgb(0, 0, 0); font-family:
times, serif; font-size: 12pt; "
class="yiv1581066733yui_3_2_0_20_134301829836475"><span
style="font-weight:bold;"><br>
</span></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
<br>
I think one way to do this is to use the PostDominator pass to
compute control-dependences for the loop and then find which basic
block(s) are dependences for the loop entry basic block. The
condition variable should be an argument to the terminator
instruction of the basic block on which the loop entry block
depends.<br>
<br>
-- John T. <br>
<br>
<blockquote
cite="mid:1343088243.55485.YahooMailNeo@web121803.mail.ne1.yahoo.com"
type="cite">
<div style="color:#000; background-color:#fff; font-family:times
new roman, new york, times, serif;font-size:12pt">
<div style="font-family: 'times new roman', 'new york', times,
serif; font-size: 12pt; ">
<div style="font-family: 'times new roman', 'new york', times,
serif; font-size: 12pt; ">
<div id="yiv1581066733">
<div style="color: rgb(0, 0, 0); background-color:
rgb(255, 255, 255); font-family: 'times new roman', 'new
york', times, serif; font-size: 12pt; ">
<div style="font-family: times, serif; ">
<div style="font-family: times, serif; ">
<div id="yiv1581066733">
<div style="background-color: rgb(255, 255, 255);
font-family: times, serif; ">
<div style="color: rgb(0, 0, 0); font-family:
times, serif; font-size: 12pt; "><span><font
face="times new roman, new york, times,
serif" size="3">Thanks in advance,</font></span></div>
<div style="color: rgb(0, 0, 0); font-family:
times, serif; font-size: 12pt; "><span><font
face="times new roman, new york, times,
serif" size="3">Edvard </font></span></div>
</div>
</div>
<br>
<br>
</div>
</div>
</div>
</div>
<br>
<br>
</div>
</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>