aboutsummaryrefslogtreecommitdiff
path: root/lib/Bitcode/Reader/BitcodeReader.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Bitcode/Reader/BitcodeReader.cpp')
-rw-r--r--lib/Bitcode/Reader/BitcodeReader.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/Bitcode/Reader/BitcodeReader.cpp b/lib/Bitcode/Reader/BitcodeReader.cpp
index ff1f35e190..96b3925ed7 100644
--- a/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -2839,6 +2839,16 @@ bool BitcodeReader::isDematerializable(const GlobalValue *GV) const {
const Function *F = dyn_cast<Function>(GV);
if (!F || F->isDeclaration())
return false;
+ // @LOCALMOD-START
+ // Don't dematerialize functions with BBs which have their address taken;
+ // it will cause any referencing blockAddress constants to also be destroyed,
+ // but because they are GVs, they need to stay around until PassManager
+ // finalization.
+ for (Function::const_iterator BB = F->begin(); BB != F->end(); ++BB) {
+ if (BB->hasAddressTaken())
+ return false;
+ }
+ // @LOCALMOD-END
return DeferredFunctionInfo.count(const_cast<Function*>(F));
}