Materialize functions whose basic blocks are used by global variables. Fixes

PR11677.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147425 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola
2012-01-02 07:49:53 +00:00
parent a86bcfb565
commit 47f79bb58e
4 changed files with 78 additions and 1 deletions

View File

@ -27,6 +27,13 @@
#include "llvm/OperandTraits.h"
using namespace llvm;
void BitcodeReader::materializeForwardReferencedFunctions() {
while (!BlockAddrFwdRefs.empty()) {
Function *F = BlockAddrFwdRefs.begin()->first;
F->Materialize();
}
}
void BitcodeReader::FreeState() {
if (BufferOwned)
delete Buffer;
@ -2779,6 +2786,9 @@ Module *llvm::getLazyBitcodeModule(MemoryBuffer *Buffer,
}
// Have the BitcodeReader dtor delete 'Buffer'.
R->setBufferOwned(true);
R->materializeForwardReferencedFunctions();
return M;
}