Files
TheRock/compiler/amd-llvm/llvm/test/Transforms/LoopIdiom/strlen-cleanup.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

44 lines
2.1 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
; RUN: opt < %s -S -passes=loop-idiom,loop-deletion | FileCheck %s
define [2 x i64] @convert_null_terminated_to_bounded_ptr(ptr noundef %p) {
; CHECK-LABEL: define [2 x i64] @convert_null_terminated_to_bounded_ptr(
; CHECK-SAME: ptr noundef [[P:%.*]]) {
; CHECK-NEXT: [[ENTRY:.*:]]
; CHECK-NEXT: [[WCSLEN:%.*]] = call i64 @wcslen(ptr [[P]])
; CHECK-NEXT: br label %[[TERMINATED_BY_LOOP_END:.*]]
; CHECK: [[TERMINATED_BY_LOOP_END]]:
; CHECK-NEXT: [[TMP0:%.*]] = getelementptr inbounds i32, ptr [[P]], i64 [[WCSLEN]]
; CHECK-NEXT: [[TERMINATED_BY_UPPER:%.*]] = getelementptr i8, ptr [[TMP0]], i64 4
; CHECK-NEXT: [[TMP1:%.*]] = ptrtoint ptr [[P]] to i64
; CHECK-NEXT: [[DOTFCA_0_INSERT:%.*]] = insertvalue [2 x i64] poison, i64 [[TMP1]], 0
; CHECK-NEXT: [[TMP2:%.*]] = ptrtoint ptr [[TERMINATED_BY_UPPER]] to i64
; CHECK-NEXT: [[DOTFCA_1_INSERT:%.*]] = insertvalue [2 x i64] [[DOTFCA_0_INSERT]], i64 [[TMP2]], 1
; CHECK-NEXT: ret [2 x i64] [[DOTFCA_1_INSERT]]
;
entry:
br label %terminated_by.loop_cond
terminated_by.loop_cond: ; preds = %terminated_by.loop_cond, %entry
%terminated_by.len.0 = phi i64 [ 0, %entry ], [ %terminated_by.new_len, %terminated_by.loop_cond ]
%0 = getelementptr inbounds i32, ptr %p, i64 %terminated_by.len.0
%terminated_by.elem = load i32, ptr %0, align 4
%terminted_by.check_terminator = icmp eq i32 %terminated_by.elem, 0
%terminated_by.new_len = add i64 %terminated_by.len.0, 1
br i1 %terminted_by.check_terminator, label %terminated_by.loop_end, label %terminated_by.loop_cond
terminated_by.loop_end: ; preds = %terminated_by.loop_cond
%1 = getelementptr inbounds i32, ptr %p, i64 %terminated_by.len.0
%terminated_by.upper = getelementptr i8, ptr %1, i64 4
%2 = ptrtoint ptr %p to i64
%.fca.0.insert = insertvalue [2 x i64] poison, i64 %2, 0
%3 = ptrtoint ptr %terminated_by.upper to i64
%.fca.1.insert = insertvalue [2 x i64] %.fca.0.insert, i64 %3, 1
ret [2 x i64] %.fca.1.insert
}
!llvm.module.flags = !{!0}
!0 = !{i32 1, !"wchar_size", i32 4}