Zaara Syeda via llvm-dev
2018-Jan-24 18:36 UTC
[llvm-dev] Memory leaks in LegacyPassManager depending on order of addRequired passes
<div class="socmaildefaultfont" dir="ltr"
style="font-family:Arial, Helvetica, sans-serif;font-size:10.5pt"
><div dir="ltr" ><div>Hello,<br><br>I
notice some strange behavior with the LegacyPassManager. I’ve added a new pass
requirement of BlockFrequencyInfoWrapperPass to
lib/Transforms/IPO/GlobalOpt.cpp.<br>However, depending on the order of
where I add it, I see memory leak errors with LeakSanitizer.</div>
<div>Having the following order shows the leak:</div>
<div>void getAnalysisUsage(AnalysisUsage &AU) const override
{<br> AU.addRequired<TargetLibraryInfoWrapperPass>();<br>
AU.addRequired<TargetTransformInfoWrapperPass>();<br>
AU.addRequired<BlockFrequencyInfoWrapperPass>();<br>
AU.addRequired<DominatorTreeWrapperPass>();<br> }</div>
<div><br>and changing it to add BlockFrequencyInfoWrapperPass after
DominatorTreeWrapperPass fixes the issue.<br>The leak comes from line 1032
of lib/IR/LegacyPassManager.cpp: Pass *AnalysisPass =
PI->createPass();<br>AnalysisPass is then passed to
addLowerLevelRequiredPass, which does not make use of it. It seems that I’m
exposing some problem with the
LegacyPassManager.<br><br>Thanks,</div>
<div>Zaara</div></div></div><BR>
Apparently Analagous Threads
- RFC: Inline expansion of memcmp vs call to standard library
- RFC: Inline expansion of memcmp vs call to standard library
- RFC: Inline expansion of memcmp vs call to standard library
- CFI directives for callee saved registers
- RFC: Inline expansion of memcmp vs call to standard library
