Files
clang-p2996/llvm/test/Transforms/Float2Int/pr54669.ll
Nikita Popov c0cc98251a [Float2Int] Make sure dependent ranges are calculated first (PR54669)
The range calculation in walkForwards() assumes that the ranges of
the operands have already been calculated. With the used visit
order, this is not necessarily the case when there are multiple
roots. (There is nothing guaranteeing that instructions are visited
in topological order.)

Fix this by queuing instructions for reprocessing if the operand
ranges haven't been calculated yet.

Fixes https://github.com/llvm/llvm-project/issues/54669.

Differential Revision: https://reviews.llvm.org/D122817
2022-04-04 10:18:39 +02:00

18 lines
483 B
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -S -float2int < %s | FileCheck %s
declare void @use(i32)
define i1 @src() {
; CHECK-LABEL: @src(
; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 -1, -1
; CHECK-NEXT: ret i1 [[CMP]]
;
%add = fadd double 2.000000e+00, -1.000000e+00
%mul = fmul double %add, 0x41EFFFFFFFE00000
%conv = fptoui double %mul to i32
%cmp = icmp eq i32 %conv, -1
%conv2 = fptoui double %add to i32
ret i1 %cmp
}