Advertisement
Guest User

strrchr non-optimization

a guest
Sep 19th, 2014
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. ; ModuleID = 'str_test.c'
  2. target 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-n8:16:32:64-S128"
  3. target triple = "x86_64-apple-macosx10.9.0"
  4.  
  5. @.str = private unnamed_addr constant [12 x i8] c"some/file.c\00", align 1
  6. @.str1 = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1
  7.  
  8. define i32 @main() nounwind ssp uwtable {
  9. %1 = alloca i32, align 4
  10. %THIS_FILE_NAME = alloca i8*, align 8
  11. store i32 0, i32* %1
  12. %2 = call i8* @strrchr(i8* getelementptr inbounds ([12 x i8]* @.str, i32 0, i32 0), i32 47)
  13. %3 = getelementptr inbounds i8* %2, i64 1
  14. store i8* %3, i8** %THIS_FILE_NAME, align 8
  15. %4 = load i8** %THIS_FILE_NAME, align 8
  16. %5 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str1, i32 0, i32 0), i8* %4)
  17. ret i32 0
  18. }
  19.  
  20. declare i8* @strrchr(i8*, i32)
  21.  
  22. declare i32 @printf(i8*, ...)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement