From bd56e4e25a6342292eb3c6ba7b391ac5826a19d8 Mon Sep 17 00:00:00 2001 From: Nemanja Ivanovic Date: Sat, 12 Mar 2016 10:23:07 +0000 Subject: Fix for PR 26378 This patch corresponds to review: http://reviews.llvm.org/D17712 We were not clearing the TOC vector in PPCAsmPrinter when initializing it. This caused duplicate definition asserts when the pass is reused on the module (i.e. with -compile-twice or in JIT contexts). llvm-svn: 263338 --- llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'llvm/lib/Target') diff --git a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp index ec354c209ca..f20665240b1 100644 --- a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp +++ b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp @@ -82,6 +82,12 @@ public: MCSymbol *lookUpOrCreateTOCEntry(MCSymbol *Sym); + virtual bool doInitialization(Module &M) override { + if (!TOC.empty()) + TOC.clear(); + return AsmPrinter::doInitialization(M); + } + void EmitInstruction(const MachineInstr *MI) override; void printOperand(const MachineInstr *MI, unsigned OpNo, raw_ostream &O); -- cgit v1.2.3