[PATCH] D12536: Function bitcode index in Value Symbol Table and lazy reading support
Teresa Johnson via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 2 09:59:24 PDT 2015
tejohnson added a comment.
New patch being uploaded. A few additional notes below.
================
Comment at: lib/Bitcode/Reader/BitcodeReader.cpp:1693
@@ +1692,3 @@
+ GO = GA->getBaseObject();
+ assert(GO);
+
----------------
tejohnson wrote:
> joker.eph wrote:
> > Minor comment: You can avoid the extra dyn_cast.
> >
> > ```
> > GlobalObject *GO;
> > // If this is an alias, need to get the actual Function object
> > // it aliases, in order to set up the DeferredFunctionInfo entry below.
> > auto *GA = dyn_cast<GlobalAlias>(V);
> > if (GA)
> > GO = GA->getBaseObject();
> > else
> > GO = dyn_cast<GlobalObject>(V);
> > assert(GO);
> > ```
> Good idea, will do.
Actually, did something similar but optimized for the common case where it isn't an alias: It does the dyn_cast to GlobalObject, and only does the dyn_cast to GlobalAlias if GO is null.
================
Comment at: lib/Bitcode/Writer/BitcodeWriter.cpp:2203
@@ -2095,1 +2202,3 @@
+ if (GA && GA->getBaseObject())
+ F = dyn_cast<Function>(GA->getBaseObject());
----------------
tejohnson wrote:
> joker.eph wrote:
> > (Minor comment: Same extra `dyn_cast` as previously)
> Will fix.
Ditto here - dyn_cast to Function, if null, do the alias check.
http://reviews.llvm.org/D12536
More information about the llvm-commits
mailing list