<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">Dear Hanbing,<br>
<br>
You haven't provided enough information to help diagnose the
problem. It would help if you specified which 3 loops actually
end up in the DenseMap.<br>
<br>
One thing to check for is if your code is in a FunctionPass. A
FunctionPass computes its results anew each time it is run on a
function, and so it's possible that this is the cause of the
problem. Similarly, the Loop objects for each function might be
deleted and re-allocated for new Loop objects every time you run
the LoopAnalysis on a new function. That would make it look like
you only have three elements when, in fact, you've added six
elements but three were deallocated.<br>
<br>
Alternatively, you might have some something silly like making ls
a local variable, so it gets destroyed each time you enter the
function/method in which it appears.<br>
<br>
However, these are just guesses. I'm not certain it can be
diagnosed even if you do provide more information.<br>
<br>
Regards,<br>
<br>
John Criswell<br>
<br>
<br>
On 8/28/14, 12:49 PM, Hanbing Li wrote:<br>
</div>
<blockquote
cite="mid:1071199000.21079311.1409244598377.JavaMail.zimbra@inria.fr"
type="cite">
<div style="font-family: times new roman, new york, times, serif;
font-size: 12pt; color: #000000">
<div>Hello, everyone,</div>
<div><br>
</div>
<div>I created a dense map like this: DenseMap<Loop *,
int> ls;</div>
<div>And I have a module which contains 3 functions:</div>
<div>function F and it has a loop which is "<span
style="font-family: Menlo; font-size: 11px;">Loop at depth 1
containing:
%1<header><exiting>,%3,%5<latch></span><span
style="font-size: 12pt;">"</span></div>
<div><span style="font-size: 12pt;" data-mce-style="font-size:
12pt;"><span style="font-size: 12pt;"
data-mce-style="font-size: 12pt;">function G and it has
two loops which are "</span></span>
<p style="margin: 0px; font-size: 11px; font-family: Menlo;"
data-mce-style="margin: 0px; font-size: 11px; font-family:
Menlo;">Loop at depth 1 containing:
%8<header><exiting>,%10,%14<latch></p>
<p style="margin: 0px; font-size: 11px; font-family: Menlo;"
data-mce-style="margin: 0px; font-size: 11px; font-family:
Menlo;">Loop at depth 1 containing:
%1<header><exiting>,%3,%5<latch></p>
<span style="font-size: 12pt;" data-mce-style="font-size:
12pt;">"</span></div>
<div><span style="font-size: 12pt;" data-mce-style="font-size:
12pt;"><span style="font-size: 12pt;"
data-mce-style="font-size: 12pt;">function main and it has
3 loops which are "</span></span>
<p style="margin: 0px; font-size: 11px; font-family: Menlo;"
data-mce-style="margin: 0px; font-size: 11px; font-family:
Menlo;">Loop at depth 1 containing:
%17<header><exiting>,%19,%23<latch></p>
<p style="margin: 0px; font-size: 11px; font-family: Menlo;"
data-mce-style="margin: 0px; font-size: 11px; font-family:
Menlo;">Loop at depth 1 containing:
%8<header><exiting>,%10,%14<latch</p>
<p style="margin: 0px; font-size: 11px; font-family: Menlo;"
data-mce-style="margin: 0px; font-size: 11px; font-family:
Menlo;">Loop at depth 1 containing:
%1<header><exiting>,%3,%5<latch></p>
<span style="font-size: 12pt;" data-mce-style="font-size:
12pt;">"</span></div>
<div><span style="font-size: 12pt;" data-mce-style="font-size:
12pt;">Then I tried to insert these loops into ls and
the expected result is that there are 6 items in ls after
the insertion. </span></div>
<div><span style="font-size: 12pt;" data-mce-style="font-size:
12pt;">But I got only 3.</span></div>
<div><span style="font-size: 12pt;" data-mce-style="font-size:
12pt;"><br>
</span></div>
<div><span style="font-size: 12pt;" data-mce-style="font-size:
12pt;">So my question is why this happened? </span></div>
<div><span style="font-size: 12pt;" data-mce-style="font-size:
12pt;">The dense map uses the name of the loop to check if
the element is in it?</span></div>
<div><span style="font-size: 12pt;" data-mce-style="font-size:
12pt;">Is there anything wrong during my code?</span></div>
<div><span style="font-size: 12pt;" data-mce-style="font-size:
12pt;"><br>
</span></div>
<div><span style="font-size: 12pt;" data-mce-style="font-size:
12pt;">Looking forward to your answer.</span></div>
<div><span style="font-size: 12pt;" data-mce-style="font-size:
12pt;"><br>
</span></div>
<div><span style="font-size: 12pt;" data-mce-style="font-size:
12pt;">Thank you</span></div>
<div><span style="font-size: 12pt;" data-mce-style="font-size:
12pt;"><br>
</span></div>
<div><span style="font-size: 12pt;" data-mce-style="font-size:
12pt;">Sincerely,</span></div>
<div><span style="font-size: 12pt;" data-mce-style="font-size:
12pt;"><br>
</span></div>
<div><span style="font-size: 12pt;" data-mce-style="font-size:
12pt;">Hanbing</span></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>