1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 12:12:47 +01:00
llvm-mirror/test/Bitcode/upgrade-linker-options-2.ll
Steven Wu b1abd6ff52 [Bitcode] Avoid duplicating linker option when upgrading
Summary:
The upgrading path from old ModuleFlag based linker options to the new
NamedMetadata based linker option in in materializeMetadata() which gets
called once for the module and once for every GV. The linker options are
getting dup'ed every time and it can create massive amount of the linker
options in the object file that gets created from old bitcode. Fix the
problem by checking if the new option exists or not before upgrade
again.

rdar://64543389

Reviewers: pcc, t.p.northover, dexonsmith, arphaman

Reviewed By: arphaman

Subscribers: hiraditya, jkorous, ributzka, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D83688
2020-07-23 13:07:28 -07:00

13 lines
437 B
LLVM

;; Test upgrade linker option doesn't create duplicated linker options.
;; Inputs is generated from IR and checked in as bitcode as it will get rejected by verifier.
;; define void @test() {
;; ret void
;; }
;; !llvm.module.flags = !{!0}
;; !0 = !{i32 6, !"Linker Options", !1}
;; !1 = !{!2}
;; !2 = !{!"-framework", !"Foundation"}
; RUN: llvm-dis %S/Inputs/linker-options.bc -o - | FileCheck %s
; CHECK: !llvm.linker.options = !{!2}