Files
TheRock/compiler/amd-llvm/llvm/test/Transforms/InstCombine/lifetime-no-null-opt.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

101 lines
4.2 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -passes=instcombine -S | FileCheck %s
declare void @llvm.dbg.declare(metadata, metadata, metadata)
declare void @llvm.lifetime.start.p0(ptr nocapture)
declare void @llvm.lifetime.end.p0(ptr nocapture)
declare void @foo(ptr nocapture, ptr nocapture)
define void @bar(i1 %flag) #0 !dbg !4 {
; CHECK-LABEL: @bar(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[TEXT:%.*]] = alloca [1 x i8], align 1
; CHECK-NEXT: [[BUFF:%.*]] = alloca [1 x i8], align 1
; CHECK-NEXT: br i1 [[FLAG:%.*]], label [[IF:%.*]], label [[ELSE:%.*]]
; CHECK: if:
; CHECK-NEXT: br label [[BB2:%.*]]
; CHECK: bb2:
; CHECK-NEXT: br label [[BB3:%.*]]
; CHECK: bb3:
; CHECK-NEXT: #dbg_declare(ptr [[TEXT]], [[META16:![0-9]+]], !DIExpression(), [[META24:![0-9]+]])
; CHECK-NEXT: br label [[FIN:%.*]]
; CHECK: else:
; CHECK-NEXT: call void @llvm.lifetime.start.p0(ptr nonnull [[TEXT]])
; CHECK-NEXT: call void @llvm.lifetime.start.p0(ptr nonnull [[BUFF]])
; CHECK-NEXT: call void @foo(ptr nonnull [[BUFF]], ptr nonnull [[TEXT]])
; CHECK-NEXT: call void @llvm.lifetime.end.p0(ptr nonnull [[BUFF]])
; CHECK-NEXT: call void @llvm.lifetime.end.p0(ptr nonnull [[TEXT]])
; CHECK-NEXT: br label [[FIN]]
; CHECK: fin:
; CHECK-NEXT: ret void
;
entry:
%text = alloca [1 x i8], align 1
%buff = alloca [1 x i8], align 1
br i1 %flag, label %if, label %else
if:
call void @llvm.lifetime.start.p0(ptr %text)
call void @llvm.lifetime.start.p0(ptr %buff)
call void @llvm.lifetime.end.p0(ptr %buff)
call void @llvm.lifetime.end.p0(ptr %text)
br label %bb2
bb2:
call void @llvm.lifetime.start.p0(ptr %text)
call void @llvm.lifetime.start.p0(ptr %buff)
call void @llvm.lifetime.end.p0(ptr %text)
call void @llvm.lifetime.end.p0(ptr %buff)
br label %bb3
bb3:
call void @llvm.lifetime.start.p0(ptr %text)
call void @llvm.dbg.declare(metadata ptr %text, metadata !14, metadata !25), !dbg !26
call void @llvm.lifetime.end.p0(ptr %text)
br label %fin
else:
call void @llvm.lifetime.start.p0(ptr %text)
call void @llvm.lifetime.start.p0(ptr %buff)
call void @foo(ptr %buff, ptr %text)
call void @llvm.lifetime.end.p0(ptr %buff)
call void @llvm.lifetime.end.p0(ptr %text)
br label %fin
fin:
ret void
}
attributes #0 = { null_pointer_is_valid }
!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!22, !23}
!llvm.ident = !{!24}
!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 3.8.0 (trunk 248826) (llvm/trunk 248827)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
!1 = !DIFile(filename: "test.cpp", directory: "/home/user")
!2 = !{}
!4 = distinct !DISubprogram(name: "bar", linkageName: "bar", scope: !1, file: !1, line: 2, type: !5, isLocal: false, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !8)
!5 = !DISubroutineType(types: !6)
!6 = !{null, !7}
!7 = !DIBasicType(name: "bool", size: 8, align: 8, encoding: DW_ATE_boolean)
!8 = !{!9, !11, !12, !14, !21}
!9 = !DILocalVariable(name: "Size", arg: 1, scope: !4, file: !1, line: 2, type: !10)
!10 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
!11 = !DILocalVariable(name: "flag", arg: 2, scope: !4, file: !1, line: 2, type: !7)
!12 = !DILocalVariable(name: "i", scope: !13, file: !1, line: 3, type: !10)
!13 = distinct !DILexicalBlock(scope: !4, file: !1, line: 3, column: 3)
!14 = !DILocalVariable(name: "text", scope: !15, file: !1, line: 4, type: !17)
!15 = distinct !DILexicalBlock(scope: !16, file: !1, line: 3, column: 30)
!16 = distinct !DILexicalBlock(scope: !13, file: !1, line: 3, column: 3)
!17 = !DICompositeType(tag: DW_TAG_array_type, baseType: !18, size: 8, align: 8, elements: !19)
!18 = !DIBasicType(name: "char", size: 8, align: 8, encoding: DW_ATE_signed_char)
!19 = !{!20}
!20 = !DISubrange(count: 1)
!21 = !DILocalVariable(name: "buff", scope: !15, file: !1, line: 5, type: !17)
!22 = !{i32 2, !"Dwarf Version", i32 4}
!23 = !{i32 2, !"Debug Info Version", i32 3}
!24 = !{!"clang version 3.8.0 (trunk 248826) (llvm/trunk 248827)"}
!25 = !DIExpression()
!26 = !DILocation(line: 4, column: 10, scope: !15)