1 ; RUN: opt < %s -functionattrs -S | grep readonly | count 3
3 %struct.X = type { i32*, i32* }
5 declare i32 @g(i32*) readonly
8 %x = alloca i32 ; <i32*> [#uses=2]
10 %y = call i32 @g(i32* %x) ; <i32> [#uses=1]
14 define i32 @foo() nounwind {
16 %y = alloca %struct.X ; <%struct.X*> [#uses=2]
17 %x = alloca %struct.X ; <%struct.X*> [#uses=2]
18 %j = alloca i32 ; <i32*> [#uses=2]
19 %i = alloca i32 ; <i32*> [#uses=2]
20 %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
21 store i32 0, i32* %i, align 4
22 store i32 1, i32* %j, align 4
23 %0 = getelementptr inbounds %struct.X* %y, i32 0, i32 0 ; <i32**> [#uses=1]
24 store i32* %i, i32** %0, align 8
25 %1 = getelementptr inbounds %struct.X* %x, i32 0, i32 1 ; <i32**> [#uses=1]
26 store i32* %j, i32** %1, align 8
27 %x1 = bitcast %struct.X* %x to i8* ; <i8*> [#uses=2]
28 %y2 = bitcast %struct.X* %y to i8* ; <i8*> [#uses=1]
29 call void @llvm.memcpy.i64(i8* %x1, i8* %y2, i64 8, i32 1)
30 %2 = bitcast i8* %x1 to i32** ; <i32**> [#uses=1]
31 %3 = load i32** %2, align 8 ; <i32*> [#uses=1]
32 %4 = load i32* %3, align 4 ; <i32> [#uses=1]
35 return: ; preds = %entry
39 declare void @llvm.memcpy.i64(i8* nocapture, i8* nocapture, i64, i32) nounwind