[ThinLTO] Ensure anonymous globals renamed even at -O0
authorTeresa Johnson <tejohnson@google.com>
Sat, 17 Sep 2016 20:40:16 +0000 (20:40 +0000)
committerTeresa Johnson <tejohnson@google.com>
Sat, 17 Sep 2016 20:40:16 +0000 (20:40 +0000)
commitfbb431b292ea2e68dec8f504373c73adb9e7ae47
treecdbcbdda2ff9bce97891db5a87319f927cc03a19
parentd4473f11260a0a12f8da24823bf4a44ab98436ce
[ThinLTO] Ensure anonymous globals renamed even at -O0

Summary:
This fixes an issue when files are compiled with -flto=thin
at default -O0. We need to rename anonymous globals before attempting
to write the module summary because all values need names for
the summary. This was happening at -O1 and above, but not before
the early exit when constructing the pipeline for -O0.

Also add an internal -prepare-for-thinlto option to enable this
to be tested via opt.

Fixes PR30419.

Reviewers: mehdi_amini

Subscribers: probinson, llvm-commits, mehdi_amini

Differential Revision: https://reviews.llvm.org/D24701

llvm-svn: 281840
llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
llvm/test/Transforms/NameAnonGlobals/rename.ll