1; RUN: opt -ipsccp -S < %s | FileCheck %s
2; PR6414
3target datalayout = "e-p: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"
4target triple = "x86_64-unknown-linux-gnu"
5
6define internal i32 ()* @f() {
7  ret i32 ()* @g
8}
9
10define internal i32 @g() {
11  ret i32 8
12}
13
14; CHECK: internal i32 @g()
15; CHECK-NEXT: ret i32 8
16
17define internal void @outer_mod() {
18  %1 = call i32 ()* () @f()                      ; <i32 ()*> [#uses=1]
19  %2 = call i32 %1()                              ; <i32> [#uses=0]
20  ret void
21}
22
23define internal void @module_init() {
24  call void @register_outer_mod(void ()* @outer_mod)
25  ret void
26}
27
28declare void @register_outer_mod(void ()*)
29
30define i32 @main() {
31  ret i32 0
32}
33