Files
TheRock/compiler/amd-llvm/llvm/test/Transforms/GVN/fake-use-constprop.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

71 lines
2.0 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 6
; RUN: opt -passes=gvn -S < %s | FileCheck %s
;
; The Global Value Numbering pass (GVN) propagates boolean values
; that are constant in dominated basic blocks to all the uses
; in these basic blocks. However, we don't want the constant propagated
; into fake.use intrinsics since this would render the intrinsic useless
; with respect to keeping the variable live up until the fake.use.
; This test checks that we don't generate any fake.uses with constant 0.
;
; Reduced from the following test case, generated with clang -O2 -S -emit-llvm -fextend-variable-liveness test.c
;
; extern void func1();
; extern int bar();
; extern void baz(int);
;
; int foo(int i, float f, int *punused)
; {
; int j = 3*i;
; if (j > 0) {
; int m = bar(i);
; if (m) {
; char b = f;
; baz(b);
; if (b)
; goto lab;
; func1();
; }
; lab:
; func1();
; }
; return 1;
; }
;; GVN should propagate a constant value through to a regular call, but not to
;; a fake use, which should continue to track the original value.
define i32 @foo(float %f) optdebug {
; CHECK-LABEL: define i32 @foo(
; CHECK-SAME: float [[F:%.*]]) #[[ATTR0:[0-9]+]] {
; CHECK-NEXT: [[CONV:%.*]] = fptosi float [[F]] to i8
; CHECK-NEXT: [[TOBOOL3:%.*]] = icmp eq i8 [[CONV]], 0
; CHECK-NEXT: br i1 [[TOBOOL3]], label %[[IF_END:.*]], label %[[LAB:.*]]
; CHECK: [[IF_END]]:
; CHECK-NEXT: tail call void (...) @bees(i8 0)
; CHECK-NEXT: tail call void (...) @llvm.fake.use(i8 [[CONV]])
; CHECK-NEXT: br label %[[LAB]]
; CHECK: [[LAB]]:
; CHECK-NEXT: ret i32 1
;
%conv = fptosi float %f to i8
%tobool3 = icmp eq i8 %conv, 0
br i1 %tobool3, label %if.end, label %lab
if.end:
tail call void (...) @bees(i8 %conv)
tail call void (...) @llvm.fake.use(i8 %conv)
br label %lab
lab:
ret i32 1
}
declare i32 @bar(...)
declare void @baz(i32)
declare void @bees(i32)
declare void @func1(...)