summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/MIRPrinter.cpp
diff options
context:
space:
mode:
authorAlex Lorenz <arphaman@gmail.com>2015-08-06 23:57:04 +0000
committerAlex Lorenz <arphaman@gmail.com>2015-08-06 23:57:04 +0000
commitcba8c5fe317bcad85d0bebb7aa68e52353f54916 (patch)
treee196c5ac32784567b6d73027e24e218d6b349e97 /llvm/lib/CodeGen/MIRPrinter.cpp
parent4c1ff05a705c55d30a8b9a12d9835362966ae4fe (diff)
downloadbcm5719-llvm-cba8c5fe317bcad85d0bebb7aa68e52353f54916.tar.gz
bcm5719-llvm-cba8c5fe317bcad85d0bebb7aa68e52353f54916.zip
MIR Serialization: Fix serialization of unnamed IR block references.
The block address machine operands can reference IR blocks in other functions. This commit fixes a bug where the references to unnamed IR blocks in other functions weren't serialized correctly. llvm-svn: 244299
Diffstat (limited to 'llvm/lib/CodeGen/MIRPrinter.cpp')
-rw-r--r--llvm/lib/CodeGen/MIRPrinter.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/MIRPrinter.cpp b/llvm/lib/CodeGen/MIRPrinter.cpp
index cc131bc4641..e162a8f73e2 100644
--- a/llvm/lib/CodeGen/MIRPrinter.cpp
+++ b/llvm/lib/CodeGen/MIRPrinter.cpp
@@ -476,7 +476,16 @@ void MIPrinter::printIRBlockReference(const BasicBlock &BB) {
printLLVMNameWithoutPrefix(OS, BB.getName());
return;
}
- int Slot = MST.getLocalSlot(&BB);
+ const Function *F = BB.getParent();
+ int Slot;
+ if (F == MST.getCurrentFunction()) {
+ Slot = MST.getLocalSlot(&BB);
+ } else {
+ ModuleSlotTracker CustomMST(F->getParent(),
+ /*ShouldInitializeAllMetadata=*/false);
+ CustomMST.incorporateFunction(*F);
+ Slot = CustomMST.getLocalSlot(&BB);
+ }
if (Slot == -1)
OS << "<badref>";
else
OpenPOWER on IntegriCloud