[PATCH] D22295: Introduce GlobalSplit pass.

Evgeniy Stepanov via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 26 13:35:54 PDT 2016


eugenis added inline comments.

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

================
Comment at: lib/Transforms/IPO/GlobalSplit.cpp:65
@@ +64,3 @@
+    // Build a global representing this split piece.
+    auto *SplitGV = new GlobalVariable(
+        *GV.getParent(), Init->getOperand(I)->getType(), GV.isConstant(),
----------------
maybe give the new global a human-readable IR name

================
Comment at: lib/Transforms/IPO/GlobalSplit.cpp:110
@@ +109,3 @@
+  // elements of the global, so replace with undef.
+  GV.replaceAllUsesWith(UndefValue::get(GV.getType()));
+  GV.eraseFromParent();
----------------
avoid creating the new undef value if there are no remaining uses


https://reviews.llvm.org/D22295





More information about the llvm-commits mailing list