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

Nemanja Ivanovic via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 1 11:34:48 PST 2016


nemanjai updated this revision to Diff 49521.
nemanjai added a comment.

Added the test case from the PR that I initially forgot to svn add.


Repository:
  rL LLVM

http://reviews.llvm.org/D17712

Files:
  lib/Target/PowerPC/PPCAsmPrinter.cpp
  test/CodeGen/PowerPC/pr26378.ll

Index: test/CodeGen/PowerPC/pr26378.ll
===================================================================
--- test/CodeGen/PowerPC/pr26378.ll
+++ test/CodeGen/PowerPC/pr26378.ll
@@ -0,0 +1,6 @@
+; RUN: llc -compile-twice -filetype obj \
+; RUN:   -mtriple=powerpc64le-unknown-unknown -mcpu=pwr8
+ at foo = common global i32 0, align 4
+define i8* @blah() #0 {
+  ret i8* bitcast (i32* @foo to i8*)
+}  
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.49521.patch
Type: text/x-patch
Size: 973 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160301/11fe7748/attachment.bin>


More information about the llvm-commits mailing list