Aiden Grossman 4d5d2ffd3e
[ProfCheck] Add prof data for lowering of @llvm.cond.loop
When there is no target-specific lowering of @llvm.cond.loop, it is
lowered into a simple loop by PreISelIntrinsicLowering. Mark the branch
weights into the no-return loop as unknown given we do not have value
metadata to fix the profcheck test for this feature.

Reviewers: mtrofin, alanzhao1, snehasish, pcc

Pull Request: https://github.com/llvm/llvm-project/pull/180390
2026-02-08 10:16:58 -08:00

34 lines
1.3 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 6
; REQUIRES: x86-registered-target, mips-registered-target
; RUN: opt -mtriple=x86_64 -passes=pre-isel-intrinsic-lowering -S < %s | FileCheck --check-prefix=X86 %s
; RUN: opt -mtriple=mips64 -passes=pre-isel-intrinsic-lowering -S < %s | FileCheck --check-prefix=MIPS %s
define void @f1(i64 %a, i64 %b) !prof !0 {
; X86-LABEL: define void @f1(
; X86-SAME: i64 [[A:%.*]], i64 [[B:%.*]]) !prof [[PROF0:![0-9]+]] {
; X86-NEXT: [[CMP:%.*]] = icmp ult i64 [[A]], [[B]]
; X86-NEXT: call void @llvm.cond.loop(i1 [[CMP]])
; X86-NEXT: ret void
;
; MIPS-LABEL: define void @f1(
; MIPS-SAME: i64 [[A:%.*]], i64 [[B:%.*]]) !prof [[PROF0:![0-9]+]] {
; MIPS-NEXT: [[CMP:%.*]] = icmp ult i64 [[A]], [[B]]
; MIPS-NEXT: br i1 [[CMP]], label %[[BB1:.*]], label %[[BB2:.*]], !prof [[PROF1:![0-9]+]]
; MIPS: [[BB1]]:
; MIPS-NEXT: br label %[[BB1]]
; MIPS: [[BB2]]:
; MIPS-NEXT: ret void
;
%cmp = icmp ult i64 %a, %b
call void @llvm.cond.loop(i1 %cmp)
ret void
}
!0 = !{!"function_entry_count", i64 1000}
;.
; X86: [[PROF0]] = !{!"function_entry_count", i64 1000}
;.
; MIPS: [[PROF0]] = !{!"function_entry_count", i64 1000}
; MIPS: [[PROF1]] = !{!"unknown", !"pre-isel-intrinsic-lowering"}
;.