Files
TheRock/compiler/amd-llvm/llvm/test/Transforms/GlobalOpt/evaluate-call.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

84 lines
2.5 KiB
LLVM

; Checks if bitcasted call expression can be evaluated
; Given call expresion:
; ptr @_ZL3fooP3Foo(ptr @gBar)
; We evaluate call to function @_ZL3fooP3Foo casting both parameter and return value
; Given call expression:
; void @_ZL3bazP3Foo(ptr @gBar)
; We evaluate call to function _ZL3bazP3Foo casting its parameter and check that evaluated value (nullptr)
; is handled correctly
; RUN: opt -passes=globalopt,instcombine -S %s -o - | FileCheck %s
; CHECK: @gBar = local_unnamed_addr global %struct.Bar { i32 2 }
; CHECK-NEXT: @_s = local_unnamed_addr global %struct.S { i32 1 }, align 4
; CHECK-NEXT: @llvm.global_ctors = appending global [0 x { i32, ptr, ptr }] zeroinitializer
; CHECK: define i32 @main()
; CHECK-NEXT: ret i32 0
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.12.0"
%struct.Bar = type { i32 }
%struct.S = type { i32 }
%struct.Foo = type { i32 }
@gBar = global %struct.Bar zeroinitializer, align 4
@_s = global %struct.S zeroinitializer, align 4
@llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 65535, ptr @_GLOBAL__sub_I_main.cpp, ptr null }]
define internal void @__cxx_global_var_init() section "__TEXT,__StaticInit,regular,pure_instructions" {
call void @_ZN1SC1Ev_alias(ptr @_s)
ret void
}
@_ZN1SC1Ev_alias = linkonce_odr unnamed_addr alias void (ptr), ptr @_ZN1SC1Ev
define linkonce_odr void @_ZN1SC1Ev(ptr) unnamed_addr align 2 {
%2 = alloca ptr, align 8
store ptr %0, ptr %2, align 8
%3 = load ptr, ptr %2, align 8
call void @_ZN1SC2Ev(ptr %3)
ret void
}
define i32 @main() {
%1 = alloca i32, align 4
store i32 0, ptr %1, align 4
ret i32 0
}
define linkonce_odr void @_ZN1SC2Ev(ptr) unnamed_addr align 2 {
%2 = alloca ptr, align 8
store ptr %0, ptr %2, align 8
%3 = load ptr, ptr %2, align 8
%4 = call ptr @_ZL3fooP3Foo(ptr @gBar)
%5 = load i32, ptr %4, align 4
store i32 %5, ptr %3, align 4
call void @_ZL3bazP3Foo(ptr @gBar)
ret void
}
define internal ptr @_ZL3fooP3Foo(ptr) {
%2 = alloca ptr, align 8
store ptr %0, ptr %2, align 8
%3 = load ptr, ptr %2, align 8
store i32 1, ptr %3, align 4
%4 = load ptr, ptr %2, align 8
ret ptr %4
}
define internal void @_ZL3bazP3Foo(ptr) {
%2 = alloca ptr, align 8
store ptr %0, ptr %2, align 8
%3 = load ptr, ptr %2, align 8
store i32 2, ptr %3, align 4
ret void
}
; Function Attrs: noinline ssp uwtable
define internal void @_GLOBAL__sub_I_main.cpp() section "__TEXT,__StaticInit,regular,pure_instructions" {
call void @__cxx_global_var_init()
ret void
}