[LLVMdev] The problem of densemap and loop
John Criswell
jtcriswel at gmail.com
Thu Aug 28 09:59:52 PDT 2014
Dear Hanbing,
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.
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.
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.
However, these are just guesses. I'm not certain it can be diagnosed
even if you do provide more information.
Regards,
John Criswell
On 8/28/14, 12:49 PM, Hanbing Li wrote:
> Hello, everyone,
>
> I created a dense map like this: DenseMap<Loop *, int> ls;
> And I have a module which contains 3 functions:
> function F and it has a loop which is "Loop at depth 1 containing:
> %1<header><exiting>,%3,%5<latch>"
> function G and it has two loops which are "
>
> Loop at depth 1 containing: %8<header><exiting>,%10,%14<latch>
>
> Loop at depth 1 containing: %1<header><exiting>,%3,%5<latch>
>
> "
> function main and it has 3 loops which are "
>
> Loop at depth 1 containing: %17<header><exiting>,%19,%23<latch>
>
> Loop at depth 1 containing: %8<header><exiting>,%10,%14<latch
>
> Loop at depth 1 containing: %1<header><exiting>,%3,%5<latch>
>
> "
> Then I tried to insert these loops into ls and the expected result is
> that there are 6 items in ls after the insertion.
> But I got only 3.
>
> So my question is why this happened?
> The dense map uses the name of the loop to check if the element is in it?
> Is there anything wrong during my code?
>
> Looking forward to your answer.
>
> Thank you
>
> Sincerely,
>
> Hanbing
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140828/0bfbe6e6/attachment.html>
More information about the llvm-dev
mailing list