[PATCH] D15996: Avoid undefined behavior in LinkAllPasses.h

Mehdi Amini via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 12 08:41:13 PST 2016


You need to be careful that an LTO build won’t inline and eliminate this.

— 
Mehdi

> On Jan 12, 2016, at 8:02 AM, David Blaikie via llvm-commits <llvm-commits at lists.llvm.org> wrote:
> 
> Do you need to call anything? Could you just take the address of the function and return it, stuff it in a global, or otherwise escape it?
> 
> On Tue, Jan 12, 2016 at 12:02 AM, Dimitry Andric via llvm-commits <llvm-commits at lists.llvm.org <mailto:llvm-commits at lists.llvm.org>> wrote:
> dim added a subscriber: grosser.
> 
> ================
> Comment at: include/llvm/LinkAllPasses.h:191
> @@ -190,3 +196,3 @@
>        llvm::RGPassManager RGM;
> -      ((llvm::RegionPass*)nullptr)->runOnRegion((llvm::Region*)nullptr, RGM);
>        llvm::AliasSetTracker X(*(llvm::AliasAnalysis*)nullptr);
> ----------------
> @grosser, you originally added this part in rL117263 ("Reference RegionPass to stop it being eliminated"), do you have any suggestions? If the goal is to to unsure RegionPass.cpp is linked in, I think we can call `RegionPass::createPrinterPass()` instead.
> 
> 
> http://reviews.llvm.org/D15996 <http://reviews.llvm.org/D15996>
> 
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org <mailto:llvm-commits at lists.llvm.org>
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits <http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits>
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160112/b126a088/attachment.html>


More information about the llvm-commits mailing list