blob: 5875b211f7767db4377e8b1663fbc902090ebc15 [file] [log] [blame]
Dan Gohman3c7d3082009-09-11 18:01:28 +00001; RUN: opt < %s -simplify-libcalls -S | FileCheck %s
Dan Gohman18101d52009-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