forked from JuliaLang/julia
-
Notifications
You must be signed in to change notification settings - Fork 0
/
llvm-D17712.patch
52 lines (43 loc) · 1.72 KB
/
llvm-D17712.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
From 6f20310e9eede9ab68fea1ffdfba9881b8b80684 Mon Sep 17 00:00:00 2001
From: Nemanja Ivanovic <[email protected]>
Date: Sat, 12 Mar 2016 10:23:07 +0000
Subject: [PATCH] Fix for PR 26378
This patch corresponds to review:
http:https://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).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@263338 91177308-0d34-0410-b5e6-96231b3b80d8
---
lib/Target/PowerPC/PPCAsmPrinter.cpp | 6 ++++++
test/CodeGen/PowerPC/pr26378.ll | 6 ++++++
2 files changed, 12 insertions(+)
create mode 100644 test/CodeGen/PowerPC/pr26378.ll
diff --git a/lib/Target/PowerPC/PPCAsmPrinter.cpp b/lib/Target/PowerPC/PPCAsmPrinter.cpp
index ec354c2..f206652 100644
--- a/lib/Target/PowerPC/PPCAsmPrinter.cpp
+++ b/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/test/CodeGen/PowerPC/pr26378.ll b/test/CodeGen/PowerPC/pr26378.ll
new file mode 100644
index 0000000..e5e2055
--- /dev/null
+++ b/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*)
+}
--
2.7.4