diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2011-11-15 19:08:46 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2011-11-15 19:08:46 +0000 |
commit | 6c5b2dcd8385e2465f1b9f628d4368fa7c5a3c77 (patch) | |
tree | 5b604349b4568460d6e88467da9b746b66f9e66b /lib | |
parent | 1b71950812a7595916d85b03d9ec8413ba8c13f1 (diff) | |
download | external_llvm-6c5b2dcd8385e2465f1b9f628d4368fa7c5a3c77.zip external_llvm-6c5b2dcd8385e2465f1b9f628d4368fa7c5a3c77.tar.gz external_llvm-6c5b2dcd8385e2465f1b9f628d4368fa7c5a3c77.tar.bz2 |
We currently use a callback to handle an IL pass deleting a BB that still
has a reference to it. Unfortunately, that doesn't work for codegen passes
since we don't get notified of MBB's being deleted (the original BB stays).
Use that fact to our advantage and after printing a function, check if
any of the IL BBs corresponds to a symbol that was not printed. This fixes
pr11202.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144674 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index ec4d30c..18670fe 100644 --- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -736,6 +736,18 @@ void AsmPrinter::EmitFunctionBody() { OutStreamer.EmitRawText(StringRef("\tnop\n")); } + const Function *F = MF->getFunction(); + for (Function::const_iterator i = F->begin(), e = F->end(); i != e; ++i) { + const BasicBlock *BB = i; + if (!BB->hasAddressTaken()) + continue; + MCSymbol *Sym = GetBlockAddressSymbol(BB); + if (Sym->isDefined()) + continue; + OutStreamer.AddComment("Address of block that was removed by CodeGen"); + OutStreamer.EmitLabel(Sym); + } + // Emit target-specific gunk after the function body. EmitFunctionBodyEnd(); |