aboutsummaryrefslogtreecommitdiff
path: root/llvm/test/Bitcode/thinlto-index-flags.ll
blob: e957ce681038a872811bb42352cdc21c304eeda0 (plain)
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
; REQUIRES: x86-registered-target
; RUN: opt -module-summary %s -o %t.o

;; By default, the indexing step should perform and set the appropriate index
;; flags for dead stripping, attribute propagation, DSO local propagation,
;; and internalization/promotion.
; RUN: llvm-lto2 run %t.o -o %t.out -thinlto-distributed-indexes \
; RUN:		-r %t.o,glob,plx
; RUN: llvm-bcanalyzer -dump %t.o.thinlto.bc | FileCheck %s --check-prefix=ALL
;; The flag value should be 0x461 aka 1121:
;; 0x1: Dead stripping
;; 0x20: Attribute propagation
;; 0x40: DSO local propagation
;; 0x400: Internalization/promotion
; ALL: <FLAGS op0=1121/>

;; Ensure dead stripping performed flag is not set on distributed index
;; when option used to disable dead stripping computation.
; RUN: llvm-lto2 run %t.o -o %t.out -thinlto-distributed-indexes \
; RUN:		-r %t.o,glob,plx -compute-dead=false
; RUN: llvm-bcanalyzer -dump %t.o.thinlto.bc | FileCheck %s --check-prefix=NODEAD
;; Flag should be 0x460 aka 1120.
; NODEAD: <FLAGS op0=1120/>

;; Disabling attribute propagation should disable that as well as DSO local
;; propagation.
; RUN: llvm-lto2 run %t.o -o %t.out -thinlto-distributed-indexes \
; RUN:		-r %t.o,glob,plx -propagate-attrs=false
; RUN: llvm-bcanalyzer -dump %t.o.thinlto.bc | FileCheck %s --check-prefix=NOPROP
;; Flag should be 0x401 aka 1025.
; NOPROP: <FLAGS op0=1025/>

;; Note there isn't currently a way to disable internalization+promotion, which
;; are performed together.

target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@glob = global i32 0