Files
TheRock/compiler/amd-llvm/llvm/test/Transforms/InstCombine/strto-1.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

83 lines
2.7 KiB
LLVM

; Test that the strto* library call simplifiers works correctly.
;
; RUN: opt < %s -passes='function(instcombine),inferattrs' -S | FileCheck %s
target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
declare i32 @strtol(ptr %s, ptr %endptr, i32 %base)
; CHECK: declare i32 @strtol(ptr readonly, ptr captures(none), i32)
declare double @strtod(ptr %s, ptr %endptr)
; CHECK: declare double @strtod(ptr readonly, ptr captures(none))
declare float @strtof(ptr %s, ptr %endptr)
; CHECK: declare float @strtof(ptr readonly, ptr captures(none))
declare i64 @strtoul(ptr %s, ptr %endptr, i32 %base)
; CHECK: declare i64 @strtoul(ptr readonly, ptr captures(none), i32)
declare i64 @strtoll(ptr %s, ptr %endptr, i32 %base)
; CHECK: declare i64 @strtoll(ptr readonly, ptr captures(none), i32)
declare double @strtold(ptr %s, ptr %endptr)
; CHECK: declare double @strtold(ptr readonly, ptr captures(none))
declare i64 @strtoull(ptr %s, ptr %endptr, i32 %base)
; CHECK: declare i64 @strtoull(ptr readonly, ptr captures(none), i32)
define void @test_simplify1(ptr %x, ptr %endptr) {
; CHECK-LABEL: @test_simplify1(
call i32 @strtol(ptr %x, ptr null, i32 10)
; CHECK-NEXT: call i32 @strtol(ptr captures(none) %x, ptr null, i32 10)
ret void
}
define void @test_simplify2(ptr %x, ptr %endptr) {
; CHECK-LABEL: @test_simplify2(
call double @strtod(ptr %x, ptr null)
; CHECK-NEXT: call double @strtod(ptr captures(none) %x, ptr null)
ret void
}
define void @test_simplify3(ptr %x, ptr %endptr) {
; CHECK-LABEL: @test_simplify3(
call float @strtof(ptr %x, ptr null)
; CHECK-NEXT: call float @strtof(ptr captures(none) %x, ptr null)
ret void
}
define void @test_simplify4(ptr %x, ptr %endptr) {
; CHECK-LABEL: @test_simplify4(
call i64 @strtoul(ptr %x, ptr null, i32 10)
; CHECK-NEXT: call i64 @strtoul(ptr captures(none) %x, ptr null, i32 10)
ret void
}
define void @test_simplify5(ptr %x, ptr %endptr) {
; CHECK-LABEL: @test_simplify5(
call i64 @strtoll(ptr %x, ptr null, i32 10)
; CHECK-NEXT: call i64 @strtoll(ptr captures(none) %x, ptr null, i32 10)
ret void
}
define void @test_simplify6(ptr %x, ptr %endptr) {
; CHECK-LABEL: @test_simplify6(
call double @strtold(ptr %x, ptr null)
; CHECK-NEXT: call double @strtold(ptr captures(none) %x, ptr null)
ret void
}
define void @test_simplify7(ptr %x, ptr %endptr) {
; CHECK-LABEL: @test_simplify7(
call i64 @strtoull(ptr %x, ptr null, i32 10)
; CHECK-NEXT: call i64 @strtoull(ptr captures(none) %x, ptr null, i32 10)
ret void
}
define void @test_no_simplify1(ptr %x, ptr %endptr) {
; CHECK-LABEL: @test_no_simplify1(
call i32 @strtol(ptr %x, ptr %endptr, i32 10)
; CHECK-NEXT: call i32 @strtol(ptr %x, ptr %endptr, i32 10)
ret void
}