[PATCH] D22295: Introduce GlobalSplit pass.

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 26 15:46:52 PDT 2016


pcc added inline comments.

================
Comment at: lib/Transforms/IPO/GlobalSplit.cpp:51
@@ +50,3 @@
+        !isa<ConstantInt>(GEP->getOperand(2)))
+      return false;
+  }
----------------
eli.friedman wrote:
> Don't you also need to check the users of the GEP?  The result of getInBoundsIndex() only has a semantic effect for loads and stores.
If each user of a global is an inrange getelementptr constant (and nothing else can take its address, i.e. it has local linkage), it follows that any loads from or stores to that global must use a pointer derived from an inrange getelementptr constant, which is sufficient to allow us to apply the splitting transform.

Added a comment documenting this.

================
Comment at: lib/Transforms/IPO/GlobalSplit.cpp:55
@@ +54,3 @@
+  SmallVector<MDNode *, 2> Types;
+  GV.getMetadata(LLVMContext::MD_type, Types);
+
----------------
eugenis wrote:
> Btw would you like to add a paragraph on !type metadata to http://llvm.org/docs/LangRef.html ?
r276817


https://reviews.llvm.org/D22295





More information about the llvm-commits mailing list