Home | History | Annotate | Download | only in SimplifyLibCalls
      1 ; RUN: opt < %s -simplify-libcalls -S | FileCheck %s
      2 ; 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
     12 define i32 @foo() nounwind {
     13 entry:
     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
     20 define i32 @bar() nounwind {
     21 entry:
     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 
     26 declare i32 @strcmp(i8*, i8*) nounwind readonly
     27