[llvm] r353992 - [ConstProp] add IR tests to show miscompiles; NFC

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 13 15:27:31 PST 2019


Author: spatel
Date: Wed Feb 13 15:27:31 2019
New Revision: 353992

URL: http://llvm.org/viewvc/llvm-project?rev=353992&view=rev
Log:
[ConstProp] add IR tests to show miscompiles; NFC

A fix for these is proposed in D51216.

Modified:
    llvm/trunk/test/Transforms/ConstProp/bitcast.ll

Modified: llvm/trunk/test/Transforms/ConstProp/bitcast.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/ConstProp/bitcast.ll?rev=353992&r1=353991&r2=353992&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/ConstProp/bitcast.ll (original)
+++ llvm/trunk/test/Transforms/ConstProp/bitcast.ll Wed Feb 13 15:27:31 2019
@@ -22,3 +22,39 @@ define i1 @bad_icmp_constexpr_bitcast()
   %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)
   ret i1 %cmp
 }
+
+; FIXME: If the bitcasts result in a NaN FP value, then "ordered and equal" would be false.
+
+define i1 @fcmp_constexpr_oeq(float %conv) {
+; CHECK-LABEL: @fcmp_constexpr_oeq(
+; CHECK-NEXT:    ret i1 true
+;
+  %cmp = fcmp oeq float bitcast (i32 ptrtoint (i16* @a to i32) to float), bitcast (i32 ptrtoint (i16* @a to i32) to float)
+  ret i1 %cmp
+}
+
+; FIXME: If the bitcasts result in a NaN FP value, then "unordered or not equal" would be true.
+
+define i1 @fcmp_constexpr_une(float %conv) {
+; CHECK-LABEL: @fcmp_constexpr_une(
+; CHECK-NEXT:    ret i1 false
+;
+  %cmp = fcmp une float bitcast (i32 ptrtoint (i16* @a to i32) to float), bitcast (i32 ptrtoint (i16* @a to i32) to float)
+  ret i1 %cmp
+}
+
+define i1 @fcmp_constexpr_ueq(float %conv) {
+; CHECK-LABEL: @fcmp_constexpr_ueq(
+; CHECK-NEXT:    ret i1 true
+;
+  %cmp = fcmp ueq float bitcast (i32 ptrtoint (i16* @a to i32) to float), bitcast (i32 ptrtoint (i16* @a to i32) to float)
+  ret i1 %cmp
+}
+
+define i1 @fcmp_constexpr_one(float %conv) {
+; CHECK-LABEL: @fcmp_constexpr_one(
+; CHECK-NEXT:    ret i1 false
+;
+  %cmp = fcmp one float bitcast (i32 ptrtoint (i16* @a to i32) to float), bitcast (i32 ptrtoint (i16* @a to i32) to float)
+  ret i1 %cmp
+}




More information about the llvm-commits mailing list