llvm-project/llvm/test/Transforms/SCCP/ip-constant-ranges-intersection.ll
Pedro Lobo dad14d4d72
[SCCP] Merge return range attributes (#105998)
Take the intersection of the existing range attribute for the return
value and the inferred range.
2024-08-26 09:35:05 +02:00

17 lines
524 B
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
; RUN: opt < %s -passes=ipsccp -S | FileCheck %s
declare range(i32 0, 20) i32 @callee(i32)
define range(i32 10, 30) i32 @caller(i32 %x) {
; CHECK-LABEL: define range(i32 10, 20) i32 @caller(
; CHECK-SAME: i32 [[X:%.*]]) {
; CHECK-NEXT: [[ENTRY:.*:]]
; CHECK-NEXT: [[CALL:%.*]] = call range(i32 0, 20) i32 @callee()
; CHECK-NEXT: ret i32 [[CALL]]
;
entry:
%call = call range(i32 0, 20) i32 @callee()
ret i32 %call
}