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
243 lines
7.2 KiB
LLVM
243 lines
7.2 KiB
LLVM
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
|
|
; RUN: opt < %s -passes='function-attrs' -S | FileCheck %s
|
|
|
|
@g_var = external global [0 x i8]
|
|
|
|
define i32 @test_ret_constant() {
|
|
; CHECK-LABEL: define noundef i32 @test_ret_constant(
|
|
; CHECK-SAME: ) #[[ATTR0:[0-9]+]] {
|
|
; CHECK-NEXT: ret i32 0
|
|
;
|
|
ret i32 0
|
|
}
|
|
|
|
define i32 @test_ret_poison() {
|
|
; CHECK-LABEL: define i32 @test_ret_poison(
|
|
; CHECK-SAME: ) #[[ATTR0]] {
|
|
; CHECK-NEXT: ret i32 poison
|
|
;
|
|
ret i32 poison
|
|
}
|
|
|
|
define i32 @test_ret_undef() {
|
|
; CHECK-LABEL: define i32 @test_ret_undef(
|
|
; CHECK-SAME: ) #[[ATTR0]] {
|
|
; CHECK-NEXT: ret i32 undef
|
|
;
|
|
ret i32 undef
|
|
}
|
|
|
|
define i32 @test_ret_param(i32 %x) {
|
|
; CHECK-LABEL: define i32 @test_ret_param(
|
|
; CHECK-SAME: i32 returned [[X:%.*]]) #[[ATTR0]] {
|
|
; CHECK-NEXT: ret i32 [[X]]
|
|
;
|
|
ret i32 %x
|
|
}
|
|
|
|
define i32 @test_ret_noundef_param(i32 noundef %x) {
|
|
; CHECK-LABEL: define noundef i32 @test_ret_noundef_param(
|
|
; CHECK-SAME: i32 noundef returned [[X:%.*]]) #[[ATTR0]] {
|
|
; CHECK-NEXT: ret i32 [[X]]
|
|
;
|
|
ret i32 %x
|
|
}
|
|
|
|
define i32 @test_ret_noundef_expr(i32 noundef %x) {
|
|
; CHECK-LABEL: define noundef i32 @test_ret_noundef_expr(
|
|
; CHECK-SAME: i32 noundef [[X:%.*]]) #[[ATTR0]] {
|
|
; CHECK-NEXT: [[Y:%.*]] = add i32 [[X]], 1
|
|
; CHECK-NEXT: ret i32 [[Y]]
|
|
;
|
|
%y = add i32 %x, 1
|
|
ret i32 %y
|
|
}
|
|
|
|
define i32 @test_ret_create_poison_expr(i32 noundef %x) {
|
|
; CHECK-LABEL: define i32 @test_ret_create_poison_expr(
|
|
; CHECK-SAME: i32 noundef [[X:%.*]]) #[[ATTR0]] {
|
|
; CHECK-NEXT: [[Y:%.*]] = add nsw i32 [[X]], 1
|
|
; CHECK-NEXT: ret i32 [[Y]]
|
|
;
|
|
%y = add nsw i32 %x, 1
|
|
ret i32 %y
|
|
}
|
|
|
|
define i32 @test_ret_freezed(i32 noundef %x) {
|
|
; CHECK-LABEL: define noundef i32 @test_ret_freezed(
|
|
; CHECK-SAME: i32 noundef [[X:%.*]]) #[[ATTR0]] {
|
|
; CHECK-NEXT: [[Y:%.*]] = add nsw i32 [[X]], 1
|
|
; CHECK-NEXT: [[Z:%.*]] = freeze i32 [[Y]]
|
|
; CHECK-NEXT: ret i32 [[Z]]
|
|
;
|
|
%y = add nsw i32 %x, 1
|
|
%z = freeze i32 %y
|
|
ret i32 %z
|
|
}
|
|
|
|
define i32 @test_ret_control_flow(i32 noundef %x) {
|
|
; CHECK-LABEL: define noundef i32 @test_ret_control_flow(
|
|
; CHECK-SAME: i32 noundef [[X:%.*]]) #[[ATTR0]] {
|
|
; CHECK-NEXT: [[COND:%.*]] = icmp eq i32 [[X]], 0
|
|
; CHECK-NEXT: br i1 [[COND]], label [[IF_THEN:%.*]], label [[IF_ELSE:%.*]]
|
|
; CHECK: if.then:
|
|
; CHECK-NEXT: ret i32 2
|
|
; CHECK: if.else:
|
|
; CHECK-NEXT: [[RET:%.*]] = add i32 [[X]], 1
|
|
; CHECK-NEXT: ret i32 [[RET]]
|
|
;
|
|
%cond = icmp eq i32 %x, 0
|
|
br i1 %cond, label %if.then, label %if.else
|
|
if.then:
|
|
ret i32 2
|
|
if.else:
|
|
%ret = add i32 %x, 1
|
|
ret i32 %ret
|
|
}
|
|
|
|
define i32 @test_ret_control_flow_may_poison(i32 noundef %x) {
|
|
; CHECK-LABEL: define i32 @test_ret_control_flow_may_poison(
|
|
; CHECK-SAME: i32 noundef [[X:%.*]]) #[[ATTR0]] {
|
|
; CHECK-NEXT: [[COND:%.*]] = icmp eq i32 [[X]], 0
|
|
; CHECK-NEXT: br i1 [[COND]], label [[IF_THEN:%.*]], label [[IF_ELSE:%.*]]
|
|
; CHECK: if.then:
|
|
; CHECK-NEXT: ret i32 2
|
|
; CHECK: if.else:
|
|
; CHECK-NEXT: [[RET:%.*]] = add nsw i32 [[X]], 1
|
|
; CHECK-NEXT: ret i32 [[RET]]
|
|
;
|
|
%cond = icmp eq i32 %x, 0
|
|
br i1 %cond, label %if.then, label %if.else
|
|
if.then:
|
|
ret i32 2
|
|
if.else:
|
|
%ret = add nsw i32 %x, 1
|
|
ret i32 %ret
|
|
}
|
|
|
|
; TODO: use context-sensitive analysis
|
|
define i32 @test_ret_control_flow_never_poison(i32 noundef %x) {
|
|
; CHECK-LABEL: define i32 @test_ret_control_flow_never_poison(
|
|
; CHECK-SAME: i32 noundef [[X:%.*]]) #[[ATTR0]] {
|
|
; CHECK-NEXT: [[COND:%.*]] = icmp eq i32 [[X]], 2147483647
|
|
; CHECK-NEXT: br i1 [[COND]], label [[IF_THEN:%.*]], label [[IF_ELSE:%.*]]
|
|
; CHECK: if.then:
|
|
; CHECK-NEXT: ret i32 2
|
|
; CHECK: if.else:
|
|
; CHECK-NEXT: [[RET:%.*]] = add nsw i32 [[X]], 1
|
|
; CHECK-NEXT: ret i32 [[RET]]
|
|
;
|
|
%cond = icmp eq i32 %x, 2147483647
|
|
br i1 %cond, label %if.then, label %if.else
|
|
if.then:
|
|
ret i32 2
|
|
if.else:
|
|
%ret = add nsw i32 %x, 1
|
|
ret i32 %ret
|
|
}
|
|
|
|
define i32 @test_noundef_prop() {
|
|
; CHECK-LABEL: define noundef i32 @test_noundef_prop(
|
|
; CHECK-SAME: ) #[[ATTR0]] {
|
|
; CHECK-NEXT: [[RET:%.*]] = call i32 @test_ret_constant()
|
|
; CHECK-NEXT: ret i32 [[RET]]
|
|
;
|
|
%ret = call i32 @test_ret_constant()
|
|
ret i32 %ret
|
|
}
|
|
|
|
; Don't deduce noundef for functions with sanitize_memory.
|
|
define i32 @test_ret_constant_msan() sanitize_memory {
|
|
; CHECK-LABEL: define i32 @test_ret_constant_msan(
|
|
; CHECK-SAME: ) #[[ATTR1:[0-9]+]] {
|
|
; CHECK-NEXT: ret i32 0
|
|
;
|
|
ret i32 0
|
|
}
|
|
|
|
define i64 @test_trunc_with_constexpr() {
|
|
; CHECK-LABEL: define noundef i64 @test_trunc_with_constexpr(
|
|
; CHECK-SAME: ) #[[ATTR0]] {
|
|
; CHECK-NEXT: [[ADD:%.*]] = add i32 trunc (i64 sub (i64 0, i64 ptrtoint (ptr @g_var to i64)) to i32), 1
|
|
; CHECK-NEXT: [[CONV:%.*]] = sext i32 [[ADD]] to i64
|
|
; CHECK-NEXT: ret i64 [[CONV]]
|
|
;
|
|
%add = add i32 trunc (i64 sub (i64 0, i64 ptrtoint (ptr @g_var to i64)) to i32), 1
|
|
%conv = sext i32 %add to i64
|
|
ret i64 %conv
|
|
}
|
|
|
|
define align 4 ptr @maybe_not_aligned(ptr noundef %p) {
|
|
; CHECK-LABEL: define align 4 ptr @maybe_not_aligned(
|
|
; CHECK-SAME: ptr noundef readnone returned captures(ret: address, provenance) [[P:%.*]]) #[[ATTR0]] {
|
|
; CHECK-NEXT: ret ptr [[P]]
|
|
;
|
|
ret ptr %p
|
|
}
|
|
|
|
define align 4 ptr @definitely_aligned(ptr noundef align 4 %p) {
|
|
; CHECK-LABEL: define noundef align 4 ptr @definitely_aligned(
|
|
; CHECK-SAME: ptr noundef readnone returned align 4 captures(ret: address, provenance) [[P:%.*]]) #[[ATTR0]] {
|
|
; CHECK-NEXT: ret ptr [[P]]
|
|
;
|
|
ret ptr %p
|
|
}
|
|
|
|
define nonnull ptr @maybe_not_nonnull(ptr noundef %p) {
|
|
; CHECK-LABEL: define nonnull ptr @maybe_not_nonnull(
|
|
; CHECK-SAME: ptr noundef readnone returned captures(ret: address, provenance) [[P:%.*]]) #[[ATTR0]] {
|
|
; CHECK-NEXT: ret ptr [[P]]
|
|
;
|
|
ret ptr %p
|
|
}
|
|
|
|
define nonnull ptr @definitely_nonnull(ptr noundef nonnull %p) {
|
|
; CHECK-LABEL: define noundef nonnull ptr @definitely_nonnull(
|
|
; CHECK-SAME: ptr noundef nonnull readnone returned captures(ret: address, provenance) [[P:%.*]]) #[[ATTR0]] {
|
|
; CHECK-NEXT: ret ptr [[P]]
|
|
;
|
|
ret ptr %p
|
|
}
|
|
|
|
define range(i8 0, 10) i8 @maybe_not_in_range(i8 noundef %v) {
|
|
; CHECK-LABEL: define range(i8 0, 10) i8 @maybe_not_in_range(
|
|
; CHECK-SAME: i8 noundef returned [[V:%.*]]) #[[ATTR0]] {
|
|
; CHECK-NEXT: ret i8 [[V]]
|
|
;
|
|
ret i8 %v
|
|
}
|
|
|
|
define range(i8 0, 10) i8 @definitely_in_range(i8 noundef range(i8 0, 10) %v) {
|
|
; CHECK-LABEL: define noundef range(i8 0, 10) i8 @definitely_in_range(
|
|
; CHECK-SAME: i8 noundef returned range(i8 0, 10) [[V:%.*]]) #[[ATTR0]] {
|
|
; CHECK-NEXT: ret i8 [[V]]
|
|
;
|
|
ret i8 %v
|
|
}
|
|
|
|
define nofpclass(nan) float @maybe_nofpclass(float noundef %x) {
|
|
; CHECK-LABEL: define nofpclass(nan) float @maybe_nofpclass(
|
|
; CHECK-SAME: float noundef returned [[X:%.*]]) #[[ATTR0]] {
|
|
; CHECK-NEXT: ret float [[X]]
|
|
;
|
|
ret float %x
|
|
}
|
|
|
|
define nofpclass(nan) float @compute_not_nofpclass(float noundef nofpclass(nan) %x) {
|
|
; CHECK-LABEL: define nofpclass(nan) float @compute_not_nofpclass(
|
|
; CHECK-SAME: float noundef nofpclass(nan) [[X:%.*]]) #[[ATTR0]] {
|
|
; CHECK-NEXT: [[Y:%.*]] = fmul float [[X]], +qnan
|
|
; CHECK-NEXT: ret float [[Y]]
|
|
;
|
|
%y = fmul float %x, 0x7FF8000000000000
|
|
ret float %y
|
|
}
|
|
|
|
define nofpclass(nan) float @definitely_nofpclass(float noundef nofpclass(nan) %x) {
|
|
; CHECK-LABEL: define noundef nofpclass(nan) float @definitely_nofpclass(
|
|
; CHECK-SAME: float noundef returned nofpclass(nan) [[X:%.*]]) #[[ATTR0]] {
|
|
; CHECK-NEXT: ret float [[X]]
|
|
;
|
|
ret float %x
|
|
}
|