aboutsummaryrefslogtreecommitdiff
path: root/test/Analysis/DSGraph/field-sensitive.ll
blob: 49aeaba7dfe9bc45f9837f46519f82ba8c30fa5c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
; Test that ds-aa can be used for queries that require field sensitive AA.
; RUN: llvm-upgrade < %s | llvm-as | opt -no-aa -ds-aa -load-vn -gcse | llvm-dis | not grep load

%Pair = type { int, int }

implementation

%Pair* %id(%Pair* %P) { ret %Pair *%P }

int %foo() {
	%X = alloca %Pair
	%XP = call %Pair* %id(%Pair* %X)

	%F1 = getelementptr %Pair* %X, int 0, uint 0
	%F2 = getelementptr %Pair* %XP, int 0, uint 1
	store int 14, int* %F1
	store int 0, int* %F2     ; no alias F1
	%B = load int* %F1        ; Should eliminate load!
	ret int %B
}