Files
TheRock/compiler/amd-llvm/llvm/test/Transforms/ObjCARC/opt-catchswitch.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

68 lines
2.8 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -S -passes=objc-arc < %s | FileCheck %s
target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"
target triple = "i686--windows-msvc"
declare ptr @f(ptr, ptr)
declare i32 @__CxxFrameHandler3(...)
declare dllimport ptr @llvm.objc.autoreleaseReturnValue(ptr returned)
declare dllimport ptr @llvm.objc.retain(ptr returned)
declare dllimport ptr @llvm.objc.retainAutoreleasedReturnValue(ptr returned)
declare dllimport void @llvm.objc.release(ptr)
define ptr @g(ptr %p, ptr %q) local_unnamed_addr personality ptr @__CxxFrameHandler3 {
; CHECK-LABEL: @g(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[TMP0:%.*]] = tail call ptr @llvm.objc.retain(ptr [[P:%.*]]) #[[ATTR0:[0-9]+]]
; CHECK-NEXT: [[V1:%.*]] = call ptr @f(ptr null, ptr null)
; CHECK-NEXT: [[CALL:%.*]] = invoke ptr @f(ptr [[P]], ptr [[Q:%.*]])
; CHECK-NEXT: to label [[INVOKE_CONT:%.*]] unwind label [[CATCH_DISPATCH:%.*]], !clang.arc.no_objc_arc_exceptions !0
; CHECK: catch.dispatch:
; CHECK-NEXT: [[TMP1:%.*]] = catchswitch within none [label %catch] unwind to caller
; CHECK: catch:
; CHECK-NEXT: [[TMP2:%.*]] = catchpad within [[TMP1]] [ptr null, i32 64, ptr null]
; CHECK-NEXT: catchret from [[TMP2]] to label [[CLEANUP:%.*]]
; CHECK: invoke.cont:
; CHECK-NEXT: [[TMP3:%.*]] = tail call ptr @llvm.objc.retainAutoreleasedReturnValue(ptr [[CALL]]) #[[ATTR0]]
; CHECK-NEXT: br label [[CLEANUP]]
; CHECK: cleanup:
; CHECK-NEXT: [[RETVAL_0:%.*]] = phi ptr [ [[CALL]], [[INVOKE_CONT]] ], [ null, [[CATCH:%.*]] ]
; CHECK-NEXT: tail call void @llvm.objc.release(ptr [[P]]) #[[ATTR0]], !clang.imprecise_release !0
; CHECK-NEXT: [[TMP4:%.*]] = tail call ptr @llvm.objc.autoreleaseReturnValue(ptr [[RETVAL_0]]) #[[ATTR0]]
; CHECK-NEXT: ret ptr [[RETVAL_0]]
;
entry:
%0 = tail call ptr @llvm.objc.retain(ptr %p) #0
; the following call prevents ARC optimizer from removing the retain/release
; pair on %p
%v1 = call ptr @f(ptr null, ptr null)
%1 = tail call ptr @llvm.objc.retain(ptr %q) #0
%call = invoke ptr @f(ptr %p, ptr %q)
to label %invoke.cont unwind label %catch.dispatch, !clang.arc.no_objc_arc_exceptions !0
catch.dispatch:
%2 = catchswitch within none [label %catch] unwind to caller
catch:
%3 = catchpad within %2 [ptr null, i32 64, ptr null]
catchret from %3 to label %cleanup
invoke.cont:
%4 = tail call ptr @llvm.objc.retainAutoreleasedReturnValue(ptr %call) #0
br label %cleanup
cleanup:
%retval.0 = phi ptr [ %call, %invoke.cont ], [ null, %catch ]
tail call void @llvm.objc.release(ptr %q) #0, !clang.imprecise_release !0
tail call void @llvm.objc.release(ptr %p) #0, !clang.imprecise_release !0
%5 = tail call ptr @llvm.objc.autoreleaseReturnValue(ptr %retval.0) #0
ret ptr %retval.0
}
attributes #0 = { nounwind }
!0 = !{}