File: funcimport_var.ll

package info (click to toggle)
llvm-toolchain-19 1%3A19.1.7-3~deb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm-proposed-updates
  • size: 1,998,492 kB
  • sloc: cpp: 6,951,680; ansic: 1,486,157; asm: 913,598; python: 232,024; f90: 80,126; objc: 75,281; lisp: 37,276; pascal: 16,990; sh: 10,009; ml: 5,058; perl: 4,724; awk: 3,523; makefile: 3,167; javascript: 2,504; xml: 892; fortran: 664; cs: 573
file content (34 lines) | stat: -rw-r--r-- 1,557 bytes parent folder | download | duplicates (10)
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
;; This test makes sure a static var is not selected as a callee target (it will
;; have a different GUID). Similarly, ensure that a callee GUID annotated from a
;; sample pgo profile that matches a global variable GUID (either due to code
;; changes or a hash collision), does not get considered for importing. Either
;; of these can crash compilation.
; RUN: opt -module-summary %s -o %t.bc
; RUN: opt -module-summary %p/Inputs/funcimport_var2.ll -o %t2.bc
; RUN: llvm-lto -thinlto -thinlto-action=thinlink -o %t3 %t.bc %t2.bc
; RUN: llvm-lto -thinlto -thinlto-action=import -thinlto-index=%t3 %t.bc %t2.bc
; RUN: llvm-lto -thinlto -thinlto-action=run %t.bc %t2.bc -exported-symbol=_Z4LinkPKcS0_
; RUN: llvm-nm %t.bc.thinlto.o | FileCheck %s --implicit-check-not=globalvar
; RUN: llvm-lto2 run %t.bc %t2.bc -o %t.out \
; RUN:   -r %t.bc,_Z4LinkPKcS0_,plx \
; RUN:   -r %t.bc,link,l \
; RUN:   -r %t2.bc,globalvar,plx \
; RUN:   -r %t2.bc,get_link,plx
; RUN: llvm-nm %t.out.1 | FileCheck %s --implicit-check-not=globalvar
; CHECK: U link

; REQUIRES: x86-registered-target

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

define i32 @_Z4LinkPKcS0_(ptr, ptr) local_unnamed_addr !prof !1 {
  %3 = tail call i32 @link(ptr %0, ptr %1) #2
  ret i32 %3
}

; Function Attrs: nounwind
declare i32 @link(ptr, ptr) local_unnamed_addr

;; This matches the GUID of global variable @globalvar in the other input.
!1 = !{!"function_entry_count", i64 110, i64 12887606300320728018}