Yingwei Zheng edd8b29667
[Float2Int] Make sure the CFP can be represented in the integer type (#167699)
When `convertToInteger` fails, the integer result is undefined. In this
case, we cannot use it in the subsequent steps.
Close https://github.com/llvm/llvm-project/issues/167627.
2025-11-13 20:54:32 +08:00

19 lines
674 B
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 6
; RUN: opt -S -passes=float2int < %s | FileCheck %s
; Make sure that we don't demote constant floating-point values when
; it cannot be represented by target integer type.
define i1 @pr167627() {
; CHECK-LABEL: define i1 @pr167627() {
; CHECK-NEXT: [[ENTRY:.*:]]
; CHECK-NEXT: [[FADD:%.*]] = fadd float 0xC5AAD8ABE0000000, 0xC57E819700000000
; CHECK-NEXT: [[CMP:%.*]] = fcmp one float [[FADD]], 0.000000e+00
; CHECK-NEXT: ret i1 [[CMP]]
;
entry:
%fadd = fadd float 0xC5AAD8ABE0000000, 0xC57E819700000000
%cmp = fcmp one float %fadd, 0.000000e+00
ret i1 %cmp
}