aboutsummaryrefslogtreecommitdiff
path: root/test/Transforms/DSAnalysis/arraymerge.ll
blob: f1f251e443705b7a78623b1e22e5a3aaecb68a8c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
; This testcase is used to make sure that the outer element of arrays are 
; folded completely away if possible.  This is a very common case, so it should
; be efficient.
;
; RUN: llvm-upgrade < %s | llvm-as | opt -analyze -tddatastructure
;
implementation

sbyte* %merge1([100 x sbyte] *%A, long %N) {
	%P = getelementptr [100 x sbyte] *%A, long 0, long %N
	ret sbyte* %P
}

sbyte* %merge2([100 x sbyte] *%A, long %N) {
        ; The graph for this example should end up exactly the same as for merge1
        %P1 = getelementptr [100 x sbyte] *%A, long 0, long 0
	%P2 = getelementptr sbyte* %P1, long %N
	ret sbyte* %P2
}