Files
clang-p2996/llvm/test/Transforms/InstSimplify/ConstProp/cast.ll
Arthur Eubanks 486ed88533 [ConstProp] Remove ConstantPropagation
As discussed in
http://lists.llvm.org/pipermail/llvm-dev/2020-July/143801.html.

Currently no users outside of unit tests.

Replace all instances in tests of -constprop with -instsimplify.
Notable changes in tests:
* vscale.ll - @llvm.sadd.sat.nxv16i8 is evaluated by instsimplify, use a fake intrinsic instead
* InsertElement.ll - insertelement undef is removed by instsimplify in @insertelement_undef
llvm/test/Transforms/ConstProp moved to llvm/test/Transforms/InstSimplify/ConstProp

Reviewed By: lattner, nikic

Differential Revision: https://reviews.llvm.org/D85159
2020-08-26 15:51:30 -07:00

41 lines
1010 B
LLVM

; RUN: opt < %s -instsimplify -S | FileCheck %s
; Overflow on a float to int or int to float conversion is undefined (PR21130).
define i8 @overflow_fptosi() {
; CHECK-LABEL: @overflow_fptosi(
; CHECK-NEXT: ret i8 undef
;
%i = fptosi double 1.56e+02 to i8
ret i8 %i
}
define i8 @overflow_fptoui() {
; CHECK-LABEL: @overflow_fptoui(
; CHECK-NEXT: ret i8 undef
;
%i = fptoui double 2.56e+02 to i8
ret i8 %i
}
; The maximum float is approximately 2 ** 128 which is 3.4E38.
; The constant below is 4E38. Use a 130 bit integer to hold that
; number; 129-bits for the value + 1 bit for the sign.
define float @overflow_uitofp() {
; CHECK-LABEL: @overflow_uitofp(
; CHECK-NEXT: ret float 0x7FF0000000000000
;
%i = uitofp i130 400000000000000000000000000000000000000 to float
ret float %i
}
define float @overflow_sitofp() {
; CHECK-LABEL: @overflow_sitofp(
; CHECK-NEXT: ret float 0x7FF0000000000000
;
%i = sitofp i130 400000000000000000000000000000000000000 to float
ret float %i
}