<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hi all,<br>
<br>
I got a question on loop exit condition identification based on
LLVM. I made an assumption first that loop exit conditions are
located in exiting basic blocks. Then I use
loop->getExitingBlocks() to get all BBs. However, this policy
seemed not work for combinational exit conditions, e.g. compounding
conditions consists of conditions with logical predicates. <b>The
problem is that LLVM discompose these compounding conditions and
only returns the last conditions</b>. Obviously, it is not I
wanted. I give a sample loop code segments here and attached please
find my BB flow chart drawn according to the disassemble files
(*.ll). The conditions are just for test, so pls do not take it
seriously.<br>
<br>
volatile int a;<br>
int b,e ;<br>
....<br>
<br>
void *f1 (void *notused)<br>
{<br>
int *c;<br>
int d;<br>
<br>
while (1) {<br>
c = &a;<br>
if (*c != 0 ) d = 1;<br>
if ( d != 1 && e != 0 && e != d ) break;<br>
if ( *c == e) break;<br>
}<br>
b = 1;<br>
}<br>
<br>
In the BB flow chart, B15 and B20 is the exiting block recognized by
LLVM. But One of the loop exit conditions is a combination of the
compounded branches located in B15, B12 and B9. <br>
<br>
Can any suggestion be shared with me to solve this problem?<br>
<br>
Best,<br>
Hanfeng
</body>
</html>