[PATCH] D25965: Utility functions for appending to llvm.used/llvm.compiler.used
    Peter Collingbourne via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Tue Oct 25 14:38:56 PDT 2016
    
    
  
pcc added inline comments.
================
Comment at: lib/LTO/LTOCodeGenerator.cpp:368
     llvm::function_ref<bool(const GlobalValue &)> mustPreserveGV) {
-  SetVector<Constant *> UsedValuesSet;
-  if (GlobalVariable *LLVMUsed =
-          TheModule.getGlobalVariable("llvm.compiler.used")) {
-    ConstantArray *Inits = cast<ConstantArray>(LLVMUsed->getInitializer());
-    for (auto &V : Inits->operands())
-      UsedValuesSet.insert(cast<Constant>(&V));
-    LLVMUsed->eraseFromParent();
-  }
-  llvm::Type *i8PTy = llvm::Type::getInt8PtrTy(TheModule.getContext());
+  SetVector<GlobalValue *> UsedValuesSet;
   auto mayPreserveGlobal = [&](GlobalValue &GV) {
----------------
This could be a std::vector.
================
Comment at: lib/LTO/UpdateCompilerUsed.cpp:55
   // Output
   SmallPtrSetImpl<const GlobalValue *> &LLVMUsed;
 
----------------
This could also be a std::vector, then there'd be no need to rebuild it.
Repository:
  rL LLVM
https://reviews.llvm.org/D25965
    
    
More information about the llvm-commits
mailing list