File: used.conditional3.ll

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (34 lines) | stat: -rw-r--r-- 1,116 bytes parent folder | download
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
; RUN: opt -S -passes=globaldce < %s | FileCheck %s

; Test that when performing llvm.used.conditional removals, we discover globals
; that might trigger other llvm.used.conditional liveness. See the following
; diagram of dependencies between the globals:
;
; @a -\
;      \ (conditional, see !1, satisfied)
;       \-> @b -\
;                \ (regular usage)
;                 \-> @c -\
;                          \ (conditional, see !2, satisfied)
;                           \-> @d

@a = internal unnamed_addr constant i64 42
@b = internal unnamed_addr constant ptr @c
@c = internal unnamed_addr constant i64 42
@d = internal unnamed_addr constant i64 42

; All four, and mainly @d need to stay alive:
; CHECK: @a = internal unnamed_addr constant i64 42
; CHECK: @b = internal unnamed_addr constant ptr @c
; CHECK: @c = internal unnamed_addr constant i64 42
; CHECK: @d = internal unnamed_addr constant i64 42

@llvm.used = appending global [3 x ptr] [
  ptr @a,
  ptr @b,
  ptr @d
], section "llvm.metadata"

!1 = !{ptr @b, i32 0, !{ptr @a}}
!2 = !{ptr @d, i32 0, !{ptr @c}}
!llvm.used.conditional = !{!1, !2}