[opaque pointer type] Add textual IR support for explicit type parameter to gep operator
[oota-llvm.git] / test / Transforms / LICM / hoist-invariant-load.ll
1 ; REQUIRES: asserts
2 ; RUN: opt < %s -licm -stats -S 2>&1 | grep "1 licm"
3
4 @"\01L_OBJC_METH_VAR_NAME_" = internal global [4 x i8] c"foo\00", section "__TEXT,__objc_methname,cstring_literals", align 1
5 @"\01L_OBJC_SELECTOR_REFERENCES_" = internal global i8* getelementptr inbounds ([4 x i8], [4 x i8]* @"\01L_OBJC_METH_VAR_NAME_", i32 0, i32 0), section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip"
6 @"\01L_OBJC_IMAGE_INFO" = internal constant [2 x i32] [i32 0, i32 16], section "__DATA, __objc_imageinfo, regular, no_dead_strip"
7 @llvm.used = appending global [3 x i8*] [i8* getelementptr inbounds ([4 x i8], [4 x i8]* @"\01L_OBJC_METH_VAR_NAME_", i32 0, i32 0), i8* bitcast (i8** @"\01L_OBJC_SELECTOR_REFERENCES_" to i8*), i8* bitcast ([2 x i32]* @"\01L_OBJC_IMAGE_INFO" to i8*)], section "llvm.metadata"
8
9 define void @test(i8* %x) uwtable ssp {
10 entry:
11   %x.addr = alloca i8*, align 8
12   %i = alloca i32, align 4
13   store i8* %x, i8** %x.addr, align 8
14   store i32 0, i32* %i, align 4
15   br label %for.cond
16
17 for.cond:                                         ; preds = %for.inc, %entry
18   %0 = load i32, i32* %i, align 4
19   %cmp = icmp ult i32 %0, 10000
20   br i1 %cmp, label %for.body, label %for.end
21
22 for.body:                                         ; preds = %for.cond
23   %1 = load i8*, i8** %x.addr, align 8
24   %2 = load i8*, i8** @"\01L_OBJC_SELECTOR_REFERENCES_", !invariant.load !0
25   %call = call i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*)*)(i8* %1, i8* %2)
26   br label %for.inc
27
28 for.inc:                                          ; preds = %for.body
29   %3 = load i32, i32* %i, align 4
30   %inc = add i32 %3, 1
31   store i32 %inc, i32* %i, align 4
32   br label %for.cond
33
34 for.end:                                          ; preds = %for.cond
35   ret void
36 }
37
38 declare i8* @objc_msgSend(i8*, i8*, ...) nonlazybind
39
40 !0 = !{}