[InstCombine] Add test for PR57899 (NFC)
authorNikita Popov <npopov@redhat.com>
Thu, 22 Sep 2022 13:59:43 +0000 (15:59 +0200)
committerNikita Popov <npopov@redhat.com>
Thu, 22 Sep 2022 14:00:14 +0000 (16:00 +0200)
llvm/test/Transforms/InstCombine/zext.ll

index 32b5fe0..82d9179 100644 (file)
@@ -510,3 +510,29 @@ define i8 @disguised_signbit_clear_test(i64 %x) {
   %t6 = zext i1 %t4 to i8
   ret i8 %t6
 }
+
+; FIXME: Currently miscompiled.
+define i16 @pr57899(i1 %c, i32 %x) {
+; CHECK-LABEL: @pr57899(
+; CHECK-NEXT:  entry:
+; CHECK-NEXT:    br i1 [[C:%.*]], label [[IF:%.*]], label [[JOIN:%.*]]
+; CHECK:       if:
+; CHECK-NEXT:    br label [[JOIN]]
+; CHECK:       join:
+; CHECK-NEXT:    ret i16 0
+;
+entry:
+  br i1 %c, label %if, label %join
+
+if:
+  %g.1 = select i1 false, i32 %x, i32 1
+  br label %join
+
+join:
+  %g.2 = phi i32 [ %g.1, %if ], [ 1, %entry ]
+  %tobool1 = icmp ne i32 %g.2, 4
+  %tobool3 = icmp ne i32 %g.2, 64
+  %x1 = and i1 %tobool1, %tobool3
+  %conv4 = zext i1 %x1 to i16
+  ret i16 %conv4
+}