[PATCH] D53178: merge two near-identical functions createPrivateGlobalForString into one

Kostya Serebryany via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 11 16:06:04 PDT 2018


kcc added inline comments.


================
Comment at: lib/Transforms/Instrumentation/Instrumentation.cpp:62
+  Constant *StrConst = ConstantDataArray::getString(M.getContext(), Str);
+  // We use private linkage for module-local strings. If they can be merged
+  // with another one, we set the unnamed_addr attribute.
----------------
vitalybuka wrote:
> ```
>  if (AllowMerging)
>    GV->setUnnamedAddr(GlobalValue::UnnamedAddr::Global);
>  GV->setAlignment(1); // Strings may not be merged w/o setting align 1.
> ```
done


Repository:
  rL LLVM

https://reviews.llvm.org/D53178





More information about the llvm-commits mailing list