Skip to content

Commit d05ba49

Browse files
committed
[ConstProp] add IR tests to show miscompiles; NFC
A fix for these is proposed in D51216. llvm-svn: 353992
1 parent 91ab9bf commit d05ba49

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

llvm/test/Transforms/ConstProp/bitcast.ll

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,39 @@ define i1 @bad_icmp_constexpr_bitcast() {
2222
%cmp = icmp eq i32 ptrtoint (i16* @a to i32), bitcast (float fadd (float bitcast (i32 ptrtoint (i16* @b to i32) to float), float 2.0) to i32)
2323
ret i1 %cmp
2424
}
25+
26+
; FIXME: If the bitcasts result in a NaN FP value, then "ordered and equal" would be false.
27+
28+
define i1 @fcmp_constexpr_oeq(float %conv) {
29+
; CHECK-LABEL: @fcmp_constexpr_oeq(
30+
; CHECK-NEXT: ret i1 true
31+
;
32+
%cmp = fcmp oeq float bitcast (i32 ptrtoint (i16* @a to i32) to float), bitcast (i32 ptrtoint (i16* @a to i32) to float)
33+
ret i1 %cmp
34+
}
35+
36+
; FIXME: If the bitcasts result in a NaN FP value, then "unordered or not equal" would be true.
37+
38+
define i1 @fcmp_constexpr_une(float %conv) {
39+
; CHECK-LABEL: @fcmp_constexpr_une(
40+
; CHECK-NEXT: ret i1 false
41+
;
42+
%cmp = fcmp une float bitcast (i32 ptrtoint (i16* @a to i32) to float), bitcast (i32 ptrtoint (i16* @a to i32) to float)
43+
ret i1 %cmp
44+
}
45+
46+
define i1 @fcmp_constexpr_ueq(float %conv) {
47+
; CHECK-LABEL: @fcmp_constexpr_ueq(
48+
; CHECK-NEXT: ret i1 true
49+
;
50+
%cmp = fcmp ueq float bitcast (i32 ptrtoint (i16* @a to i32) to float), bitcast (i32 ptrtoint (i16* @a to i32) to float)
51+
ret i1 %cmp
52+
}
53+
54+
define i1 @fcmp_constexpr_one(float %conv) {
55+
; CHECK-LABEL: @fcmp_constexpr_one(
56+
; CHECK-NEXT: ret i1 false
57+
;
58+
%cmp = fcmp one float bitcast (i32 ptrtoint (i16* @a to i32) to float), bitcast (i32 ptrtoint (i16* @a to i32) to float)
59+
ret i1 %cmp
60+
}

0 commit comments

Comments
 (0)