1 ; Checks for few bitcasted call evaluation errors
4 ; RUN: opt -passes=globalopt,instcombine -S -debug-only=evaluator %s -o %t 2>&1 | FileCheck %s
6 ; CHECK: Failed to fold bitcast call expr
7 ; CHECK: Can not convert function argument
9 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
10 target triple = "x86_64-apple-macosx10.12.0"
12 %struct.S = type { i32 }
13 %struct.Q = type { i32 }
14 %struct.Foo = type { i32 }
16 @_s = global %struct.S zeroinitializer, align 4
17 @_q = global %struct.Q zeroinitializer, align 4
18 @llvm.global_ctors = appending global [2 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 65535, ptr @_GLOBAL__sub_I_main2.cpp, ptr null }, { i32, ptr, ptr } { i32 65535, ptr @_GLOBAL__sub_I_main3.cpp, ptr null }]
20 define internal void @__cxx_global_var_init() section "__TEXT,__StaticInit,regular,pure_instructions" {
21 call void @_ZN1SC1Ev(ptr @_s)
25 define linkonce_odr void @_ZN1SC1Ev(ptr) unnamed_addr align 2 {
26 %2 = alloca ptr, align 8
27 store ptr %0, ptr %2, align 8
28 %3 = load ptr, ptr %2, align 8
29 call void @_ZN1SC2Ev(ptr %3)
33 define internal void @__cxx_global_var_init.1() #0 section "__TEXT,__StaticInit,regular,pure_instructions" {
34 call void @_ZN1QC1Ev(ptr @_q)
38 define linkonce_odr void @_ZN1QC1Ev(ptr) unnamed_addr align 2 {
39 %2 = alloca ptr, align 8
40 store ptr %0, ptr %2, align 8
41 %3 = load ptr, ptr %2, align 8
42 call void @_ZN1QC2Ev(ptr %3)
47 %1 = alloca i32, align 4
48 store i32 0, ptr %1, align 4
52 define linkonce_odr void @_ZN1SC2Ev(ptr) unnamed_addr align 2 {
53 %2 = alloca ptr, align 8
54 %3 = alloca %struct.Foo, align 4
55 store ptr %0, ptr %2, align 8
56 %4 = load ptr, ptr %2, align 8
57 %5 = call i32 @_ZL3foov()
58 store i32 %5, ptr %3, align 4
59 %6 = load i32, ptr %3, align 4
60 store i32 %6, ptr %4, align 4
64 define internal ptr @_ZL3foov() {
65 ret ptr getelementptr (%struct.Foo, ptr null, i32 1)
68 define linkonce_odr void @_ZN1QC2Ev(ptr) unnamed_addr align 2 {
69 %2 = alloca ptr, align 8
70 store ptr %0, ptr %2, align 8
71 %3 = load ptr, ptr %2, align 8
72 %4 = call i32 @_ZL3baz3Foo(ptr getelementptr (%struct.Foo, ptr null, i32 1))
73 store i32 %4, ptr %3, align 4
77 define internal i32 @_ZL3baz3Foo(i32) {
78 %2 = alloca %struct.Foo, align 4
79 store i32 %0, ptr %2, align 4
80 %3 = load i32, ptr %2, align 4
84 ; Function Attrs: noinline ssp uwtable
85 define internal void @_GLOBAL__sub_I_main2.cpp() section "__TEXT,__StaticInit,regular,pure_instructions" {
86 call void @__cxx_global_var_init()
90 define internal void @_GLOBAL__sub_I_main3.cpp() section "__TEXT,__StaticInit,regular,pure_instructions" {
91 call void @__cxx_global_var_init.1()