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
56 lines
2.2 KiB
LLVM
56 lines
2.2 KiB
LLVM
; RUN: opt < %s -passes=globaldce -S | FileCheck %s
|
|
|
|
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
|
|
|
|
declare dso_local noalias nonnull ptr @_Znwm(i64)
|
|
declare { ptr, i1 } @llvm.type.checked.load(ptr, i32, metadata)
|
|
|
|
; %struct.A is a C++ struct with two virtual functions, A::foo and A::bar. The
|
|
; !vcall_visibility metadata is set on the vtable, so we know that all virtual
|
|
; calls through this vtable are visible and use the @llvm.type.checked.load
|
|
; intrinsic. Function test_A makes a call to A::foo, but there is no call to
|
|
; A::bar anywhere, so A::bar can be deleted, and its vtable slot replaced with
|
|
; null.
|
|
|
|
%struct.A = type { ptr }
|
|
|
|
; The pointer to A::bar in the vtable can be removed, because it will never be
|
|
; loaded. We replace it with null to keep the layout the same. Because it is at
|
|
; the end of the vtable we could potentially shrink the vtable, but don't
|
|
; currently do that.
|
|
; CHECK: @_ZTV1A = internal unnamed_addr constant { [4 x ptr] } { [4 x ptr] [ptr null, ptr null, ptr @_ZN1A3fooEv, ptr null] }
|
|
@_ZTV1A = internal unnamed_addr constant { [4 x ptr] } { [4 x ptr] [ptr null, ptr null, ptr @_ZN1A3fooEv, ptr @_ZN1A3barEv] }, align 8, !type !0, !type !1, !type !2, !vcall_visibility !3
|
|
|
|
; A::foo is called, so must be retained.
|
|
; CHECK: define internal i32 @_ZN1A3fooEv(
|
|
define internal i32 @_ZN1A3fooEv(ptr nocapture readnone %this) {
|
|
entry:
|
|
ret i32 42
|
|
}
|
|
|
|
; A::bar is not used, so can be deleted.
|
|
; CHECK-NOT: define internal i32 @_ZN1A3barEv(
|
|
define internal i32 @_ZN1A3barEv(ptr nocapture readnone %this) {
|
|
entry:
|
|
ret i32 1337
|
|
}
|
|
|
|
define dso_local i32 @test_A() {
|
|
entry:
|
|
%call = tail call ptr @_Znwm(i64 8)
|
|
store ptr getelementptr inbounds inrange(-16, 16) ({ [4 x ptr] }, ptr @_ZTV1A, i64 0, i32 0, i64 2), ptr %call, align 8
|
|
%0 = tail call { ptr, i1 } @llvm.type.checked.load(ptr getelementptr inbounds inrange(-16, 16) ({ [4 x ptr] }, ptr @_ZTV1A, i64 0, i32 0, i64 2), i32 0, metadata !"_ZTS1A"), !nosanitize !9
|
|
%1 = extractvalue { ptr, i1 } %0, 0, !nosanitize !9
|
|
%call1 = tail call i32 %1(ptr nonnull %call)
|
|
ret i32 %call1
|
|
}
|
|
|
|
!llvm.module.flags = !{!4}
|
|
|
|
!0 = !{i64 16, !"_ZTS1A"}
|
|
!1 = !{i64 16, !"_ZTSM1AFivE.virtual"}
|
|
!2 = !{i64 24, !"_ZTSM1AFivE.virtual"}
|
|
!3 = !{i64 2}
|
|
!4 = !{i32 1, !"Virtual Function Elim", i32 1}
|
|
!9 = !{}
|