[InstSimplify] add test for select that should not be simplified; NFC
authorSanjay Patel <spatel@rotateright.com>
Mon, 13 Apr 2020 19:31:59 +0000 (15:31 -0400)
committerSanjay Patel <spatel@rotateright.com>
Tue, 14 Apr 2020 17:57:30 +0000 (13:57 -0400)
See discussion in D77868

llvm/test/Transforms/InstSimplify/select.ll

index bafcb96..139f5e3 100644 (file)
@@ -737,3 +737,16 @@ define i8 @and_cmps_wrong_type(i32 %x) {
   %r = select i1 %cmp1, i8 %s, i8 0
   ret i8 %r
 }
+
+define i1 @y_might_be_poison(float %x, float %y) {
+; CHECK-LABEL: @y_might_be_poison(
+; CHECK-NEXT:    [[C1:%.*]] = fcmp ord float 0.000000e+00, [[X:%.*]]
+; CHECK-NEXT:    [[C2:%.*]] = fcmp ord float [[X]], [[Y:%.*]]
+; CHECK-NEXT:    [[C3:%.*]] = select i1 [[C1]], i1 [[C2]], i1 false
+; CHECK-NEXT:    ret i1 [[C3]]
+;
+  %c1 = fcmp ord float 0.0, %x
+  %c2 = fcmp ord float %x, %y
+  %c3 = select i1 %c1, i1 %c2, i1 false
+  ret i1 %c3
+}