[PATCH] D17712: Fix for PR26378 (reset persistent state in PPCAsmPrinter)

Nemanja Ivanovic via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 29 04:20:53 PST 2016


nemanjai created this revision.
nemanjai added reviewers: hfinkel, kbarton, wschmidt.
nemanjai added a subscriber: llvm-commits.
nemanjai set the repository for this revision to rL LLVM.

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).

Repository:
  rL LLVM

http://reviews.llvm.org/D17712

Files:
  lib/Target/PowerPC/PPCAsmPrinter.cpp

Index: lib/Target/PowerPC/PPCAsmPrinter.cpp
===================================================================
--- lib/Target/PowerPC/PPCAsmPrinter.cpp
+++ lib/Target/PowerPC/PPCAsmPrinter.cpp
@@ -82,6 +82,12 @@
 
     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);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D17712.49358.patch
Type: text/x-patch
Size: 572 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160229/116f4275/attachment.bin>


More information about the llvm-commits mailing list