Files
TheRock/compiler/amd-llvm/llvm/test/ThinLTO/X86/reduce-promotion-devirt.ll
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

100 lines
2.9 KiB
LLVM

; Test that renaming is still performed even when we try to avoid always renaming
; on promotion. The devirtualization promotes an internal virtual target to a
; uniqued hidden symbol from a static function, and later on the static funciton
; is promoted to the same hidden symbol.
; Set up
; RUN: rm -rf %t
; RUN: mkdir -p %t
; RUN: split-file %s %t
; RUN: opt -thinlto-bc %t/a.ll -o %t/a.bc
; RUN: opt -thinlto-bc %t/b.ll -o %t/b.bc
; RUN: llvm-lto2 run %t/a.bc %t/b.bc \
; RUN: --whole-program-visibility-enabled-in-lto=true \
; RUN: -always-rename-promoted-locals=false \
; RUN: -save-temps -o %t/lto-out \
; RUN: -r %t/a.bc,test,px \
; RUN: -r %t/b.bc,_ZN1B1fEi,p \
; RUN: -r %t/b.bc,test2,px \
; RUN: -r %t/b.bc,_ZTV1B,px
; RUN: llvm-nm %t/lto-out.1 | FileCheck %s --check-prefix=NM-INDEX1
; RUN: llvm-nm %t/lto-out.2 | FileCheck %s --check-prefix=NM-INDEX2
; NM-INDEX1: U _ZN1A1nEi.llvm.
; NM-INDEX2-NOT: U _ZN1A1nEi
; NM-INDEX2: T _ZN1A1nEi.llvm.
; NM-INDEX2-NOT: U _ZN1A1nEi
; RUN: llvm-dis %t/lto-out.1.4.opt.bc -o - | FileCheck %s --check-prefix=OPT-INDEX1
; RUN: llvm-dis %t/lto-out.2.4.opt.bc -o - | FileCheck %s --check-prefix=OPT-INDEX2
; OPT-INDEX1: %call = tail call i32 @_ZN1A1nEi.llvm.
; OPT-INDEX1: declare void @_ZN1A1nEi.llvm.
; OPT-INDEX2: ptr @_ZN1A1nEi.llvm.
; OPT-INDEX2: define hidden i32 @_ZN1A1nEi.llvm.
; OPT-INDEX2: tail call i32 @_ZN1A1nEi.llvm.
;--- a.ll
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-pc-linux-gnu"
%struct.A = type { ptr }
define i32 @test(ptr %obj, i32 %a) {
entry:
%vtable = load ptr, ptr %obj
%p = call i1 @llvm.type.test(ptr %vtable, metadata !"_ZTS1A")
call void @llvm.assume(i1 %p)
%fptrptr = getelementptr ptr, ptr %vtable, i32 1
%fptr1 = load ptr, ptr %fptrptr, align 8
; the call was devirtualized.
%call = tail call i32 %fptr1(ptr nonnull %obj, i32 %a)
ret i32 %call
}
declare i1 @llvm.type.test(ptr, metadata)
declare void @llvm.assume(i1)
;--- b.ll
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-pc-linux-gnu"
%struct.A = type { ptr }
%struct.B = type { %struct.A }
@_ZTV1B = constant { [4 x ptr] } { [4 x ptr] [ptr null, ptr poison, ptr @_ZN1B1fEi, ptr @_ZN1A1nEi] }, !type !0, !type !1
define i32 @_ZN1B1fEi(ptr %this, i32 %a) #0 {
ret i32 0;
}
define internal i32 @_ZN1A1nEi(ptr %this, i32 %a) #0 {
ret i32 0;
}
define i32 @test2(ptr %obj, i32 %a) {
entry:
%vtable2 = load ptr, ptr %obj
%p2 = call i1 @llvm.type.test(ptr %vtable2, metadata !"_ZTS1B")
call void @llvm.assume(i1 %p2)
%fptrptr = getelementptr ptr, ptr %vtable2, i32 1
%fptr33 = load ptr, ptr %fptrptr, align 8
%call4 = tail call i32 %fptr33(ptr nonnull %obj, i32 %a)
ret i32 %call4
}
attributes #0 = { noinline optnone }
declare i1 @llvm.type.test(ptr, metadata)
declare void @llvm.assume(i1)
!0 = !{i64 16, !"_ZTS1A"}
!1 = !{i64 16, !"_ZTS1B"}