<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Jul 23, 2012, at 5:04 PM, Edvard Ghazaryan <<a href="mailto:edvard_gh@yahoo.com">edvard_gh@yahoo.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div><div style="background-color: rgb(255, 255, 255); font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; position: static; z-index: auto; "><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="background-color: rgb(255, 255, 255); font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; position: static; z-index: auto; "><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; position: static; z-index: auto; "><div style="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="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 style="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="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></div></div></div></div></div></div></div></div></div></blockquote><br></div><div>I'm not sure I understand the question. Here are some tips.</div><div><br></div><div>Loop::getLoopLatch() give you a canonical "latch" block if it exists. BasicBlock::getTerminator() gives you the branch. This is done throughout the code, so you can see the pattern.</div><div><br></div><div>Loop::getExitingBlocks() gives you all the branches that may leave the loop.</div><div><br></div><div>Or may want to do your own search for the "last" exit by following block predecessors from the loop header.</div><div><br></div><div>-Andy</div><div><br></div><br></body></html>