[llvm] r263338 - Fix for PR 26378
Nemanja Ivanovic via llvm-commits
llvm-commits at lists.llvm.org
Sat Mar 12 02:23:08 PST 2016
Author: nemanjai
Date: Sat Mar 12 04:23:07 2016
New Revision: 263338
URL: http://llvm.org/viewvc/llvm-project?rev=263338&view=rev
Log:
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).
Added:
llvm/trunk/test/CodeGen/PowerPC/pr26378.ll
Modified:
llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp
Modified: llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp?rev=263338&r1=263337&r2=263338&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp Sat Mar 12 04:23:07 2016
@@ -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);
Added: llvm/trunk/test/CodeGen/PowerPC/pr26378.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PowerPC/pr26378.ll?rev=263338&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/PowerPC/pr26378.ll (added)
+++ llvm/trunk/test/CodeGen/PowerPC/pr26378.ll Sat Mar 12 04:23:07 2016
@@ -0,0 +1,6 @@
+; RUN: llc -compile-twice -filetype obj \
+; RUN: -mtriple=powerpc64le-unknown-unknown -mcpu=pwr8 < %s
+ at foo = common global i32 0, align 4
+define i8* @blah() #0 {
+ ret i8* bitcast (i32* @foo to i8*)
+}
More information about the llvm-commits
mailing list