<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>