[PATCH] D15996: Avoid undefined behavior in LinkAllPasses.h
Dimitry Andric via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 12 12:38:11 PST 2016
dim added inline comments.
================
Comment at: include/llvm/LinkAllPasses.h:198
@@ -192,1 +197,3 @@
+ } BRP(0);
+ (void) BRP.createPrinterPass(os, "");
llvm::AliasSetTracker X(*(llvm::AliasAnalysis*)nullptr);
----------------
joker.eph wrote:
> Isn't instantiating a `RGPassManager` enough to force link `RegionPass.cpp`?
Well, this was already done in the original code, but then they tried to pass it as an argument to a call to `runOnRegion`. I am unsure what this gained, and why the RGPassManager appears to be a little different than the other pass managers...
That said, I think such a local object cannot be optimized out, certainly because the constructor is not inlined. The assembly shows:
leal 72(%esp), %esi
movl %esi, (%esp)
calll llvm::RGPassManager::RGPassManager()@PLT
so it's indeed definitely being called.
http://reviews.llvm.org/D15996
More information about the llvm-commits
mailing list