summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNemanja Ivanovic <nemanja.i.ibm@gmail.com>2016-03-12 10:23:07 +0000
committerNemanja Ivanovic <nemanja.i.ibm@gmail.com>2016-03-12 10:23:07 +0000
commitbd56e4e25a6342292eb3c6ba7b391ac5826a19d8 (patch)
tree1933b48bfde1ca2892509baec5a90e6684842a00
parent777f96304e249b738f4f91edf1c4dd302ad862c8 (diff)
downloadbcm5719-llvm-bd56e4e25a6342292eb3c6ba7b391ac5826a19d8.tar.gz
bcm5719-llvm-bd56e4e25a6342292eb3c6ba7b391ac5826a19d8.zip
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
-rw-r--r--llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp6
-rw-r--r--llvm/test/CodeGen/PowerPC/pr26378.ll6
2 files changed, 12 insertions, 0 deletions
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);
diff --git a/llvm/test/CodeGen/PowerPC/pr26378.ll b/llvm/test/CodeGen/PowerPC/pr26378.ll
new file mode 100644
index 00000000000..e5e20553f52
--- /dev/null
+++ b/llvm/test/CodeGen/PowerPC/pr26378.ll
@@ -0,0 +1,6 @@
+; RUN: llc -compile-twice -filetype obj \
+; RUN: -mtriple=powerpc64le-unknown-unknown -mcpu=pwr8 < %s
+@foo = common global i32 0, align 4
+define i8* @blah() #0 {
+ ret i8* bitcast (i32* @foo to i8*)
+}
OpenPOWER on IntegriCloud