[PATCH] D25965: Utility functions for appending to llvm.used/llvm.compiler.used

Mehdi AMINI via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 25 15:53:10 PDT 2016


mehdi_amini requested changes to this revision.
mehdi_amini added a reviewer: mehdi_amini.
mehdi_amini added inline comments.
This revision now requires changes to proceed.


================
Comment at: lib/LTO/UpdateCompilerUsed.cpp:117
                               const StringSet<> &AsmUndefinedRefs) {
-  SmallPtrSet<const GlobalValue *, 8> UsedValues;
   PreserveLibCallsAndAsmUsed(AsmUndefinedRefs, TM, UsedValues)
----------------
This is a set, which ensure no duplicate.


================
Comment at: lib/Transforms/Utils/ModuleUtils.cpp:104
+  for (auto *V : Values)
+    Init.push_back(ConstantExpr::getBitCast(V, Int8PtrTy));
+
----------------
eugenis wrote:
> mehdi_amini wrote:
> > What if some values that you add here are already in the global variable initializer?
> We'll end up with duplicates. This is how the current code works.
> 
> Btw, is not SmallPtrSet unstable in the "large mode", when it is backed by  hash table? Do we not care about the order of llvm.used entries being stable?
I don't believe it is how the current code work. I'll point it inline.


Repository:
  rL LLVM

https://reviews.llvm.org/D25965





More information about the llvm-commits mailing list