[PATCH] D16124: Add to the split module utility an SCC based method which allows not to globalize any local variables.

Tobias Edler von Koch via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 15 14:57:15 PST 2016


tobiasvk added inline comments.

================
Comment at: lib/Transforms/Utils/SplitModule.cpp:161
@@ +160,3 @@
+      // For each constant that is not a GV (a pure const):
+      if (isa<Constant>(U) && !isa<GlobalValue>(U)) {
+        SmallVector<const User *, 8> Worklist;
----------------
slarin wrote:
> pcc wrote:
> > You can simplify this code by removing this line.
> I am not sure about that - I will let Tobias to comment on this...
This is to handle the case where a function uses e.g. a bitcast of a GlobalValue... that bitcast would be ConstantExpr, which is shared between functions, but is not a GlobalValue itself. Constants can be nested, hence the worklist.

Oh I see, perhaps you mean that we could just always add U to the worklist, and for GlobalValues we simply wouldn't 'recurse' any deeper. If you prefer that it's fine, it just adds extra work when we already know there's only ever going to be one item on the worklist.



http://reviews.llvm.org/D16124





More information about the llvm-commits mailing list