1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt < %s -instsimplify -S | FileCheck %s
3
4target datalayout = "e-p:64:64:64-p1:16:16:16-p2:32:32:32-p3:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
5
6declare void @usei8ptr(i8* %ptr)
7
8; Ensure that we do not crash when looking at such a weird bitcast.
9define i1 @bitcast_from_single_element_pointer_vector_to_pointer(<1 x i8*> %ptr1vec, i8* %ptr2) {
10; CHECK-LABEL: @bitcast_from_single_element_pointer_vector_to_pointer(
11; CHECK-NEXT:    [[PTR1:%.*]] = bitcast <1 x i8*> [[PTR1VEC:%.*]] to i8*
12; CHECK-NEXT:    call void @usei8ptr(i8* [[PTR1]])
13; CHECK-NEXT:    [[CMP:%.*]] = icmp eq i8* [[PTR1]], [[PTR2:%.*]]
14; CHECK-NEXT:    ret i1 [[CMP]]
15;
16  %ptr1 = bitcast <1 x i8*> %ptr1vec to i8*
17  call void @usei8ptr(i8* %ptr1)
18  %cmp = icmp eq i8* %ptr1, %ptr2
19  ret i1 %cmp
20}
21
22; TODO: these should return poison
23
24define i1 @poison(i32 %x) {
25; CHECK-LABEL: @poison(
26; CHECK-NEXT:    ret i1 undef
27;
28  %v = icmp eq i32 %x, poison
29  ret i1 %v
30}
31
32define i1 @poison2(i32 %x) {
33; CHECK-LABEL: @poison2(
34; CHECK-NEXT:    ret i1 false
35;
36  %v = icmp slt i32 %x, poison
37  ret i1 %v
38}
39