blob: 934ec9b35f4f8d8305689bf2d0e215d3e20e52ac [file] [log] [blame]
Dan Gohmanb1e1e822009-09-08 16:50:01 +00001; RUN: opt %s -simplify-libcalls | llvm-dis | FileCheck %s
Dan Gohman107f41f2009-08-19 00:11:12 +00002; PR4738
3
4; SimplifyLibcalls shouldn't assume anything about weak symbols.
5
6@real_init = weak_odr constant [2 x i8] c"y\00"
7@fake_init = weak constant [2 x i8] c"y\00"
8@.str = private constant [2 x i8] c"y\00"
9
10; CHECK: define i32 @foo
11; CHECK: call i32 @strcmp
12define i32 @foo() nounwind {
13entry:
14 %t0 = call i32 @strcmp(i8* getelementptr inbounds ([2 x i8]* @fake_init, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8]* @.str, i64 0, i64 0)) nounwind readonly
15 ret i32 %t0
16}
17
18; CHECK: define i32 @bar
19; CHECK: ret i32 0
20define i32 @bar() nounwind {
21entry:
22 %t0 = call i32 @strcmp(i8* getelementptr inbounds ([2 x i8]* @real_init, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8]* @.str, i64 0, i64 0)) nounwind readonly
23 ret i32 %t0
24}
25
26declare i32 @strcmp(i8*, i8*) nounwind readonly