1; RUN: opt < %s -instcombine -S | FileCheck %s
2
3declare i32 @f32(i32**, i32**)
4
5declare i32 @f64(i64**, i64**)
6
7define i1 @icmp_func() {
8; CHECK-LABEL: @icmp_func(
9; CHECK: ret i1 false
10  %cmp = icmp eq i32 (i8*, i8*)* bitcast (i32 (i32**, i32**)* @f32 to i32 (i8*, i8*)*), bitcast (i32 (i64**, i64**)* @f64 to i32 (i8*, i8*)*)
11  ret i1 %cmp
12}
13
14define i1 @icmp_fptr(i32 (i8*, i8*)*) {
15; CHECK-LABEL: @icmp_fptr(
16; CHECK: %cmp = icmp ne i32 (i8*, i8*)* %0, bitcast (i32 (i32**, i32**)* @f32 to i32 (i8*, i8*)*)
17; CHECK: ret i1 %cmp
18  %cmp = icmp ne i32 (i8*, i8*)* bitcast (i32 (i32**, i32**)* @f32 to i32 (i8*, i8*)*), %0
19  ret i1 %cmp
20}
21
22@b = external global i32
23
24define i32 @icmp_glob(i32 %x, i32 %y) {
25; CHECK-LABEL: define i32 @icmp_glob(i32 %x, i32 %y)
26; CHECK-NEXT:   ret i32 %y
27;
28  %sel = select i1 icmp eq (i32* bitcast (i32 (i32, i32)* @icmp_glob to i32*), i32* @b), i32 %x, i32 %y
29  ret i32 %sel
30}
31