File: StrPBrk.ll

package info (click to toggle)
llvm-3.0 3.0-10
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 75,412 kB
  • sloc: cpp: 468,043; asm: 109,345; ansic: 13,782; sh: 12,935; ml: 4,716; python: 4,351; perl: 2,096; makefile: 1,905; pascal: 1,578; exp: 389; xml: 283; lisp: 187; csh: 117
file content (25 lines) | stat: -rw-r--r-- 861 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
; RUN: opt < %s -simplify-libcalls -S | FileCheck %s

target datalayout = "-p:64:64:64"

@hello = constant [12 x i8] c"hello world\00"
@w = constant [2 x i8] c"w\00"
@null = constant [1 x i8] zeroinitializer

declare i8* @strpbrk(i8*, i8*)

define void @test(i8* %s1, i8* %s2) {
	%hello_p = getelementptr [12 x i8]* @hello, i32 0, i32 0
	%w_p = getelementptr [2 x i8]* @w, i32 0, i32 0
	%null_p = getelementptr [1 x i8]* @null, i32 0, i32 0
	%test1 = call i8* @strpbrk(i8* %null_p, i8* %s2)
	%test2 = call i8* @strpbrk(i8* %s1, i8* %null_p)
; CHECK-NOT: call i8* @strpbrk
	%test3 = call i8* @strpbrk(i8* %s1, i8* %w_p)
; CHECK: call i8* @strchr(i8* %s1, i32 119)
	%test4 = call i8* @strpbrk(i8* %hello_p, i8* %w_p)
; CHECK: getelementptr i8* %hello_p, i64 6
	%test5 = call i8* @strpbrk(i8* %s1, i8* %s2)
; CHECK: call i8* @strpbrk(i8* %s1, i8* %s2)
	ret void
}