aboutsummaryrefslogtreecommitdiff
path: root/test/Transforms/DSAnalysis/arraymerge.ll
diff options
context:
space:
mode:
Diffstat (limited to 'test/Transforms/DSAnalysis/arraymerge.ll')
-rw-r--r--test/Transforms/DSAnalysis/arraymerge.ll18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/Transforms/DSAnalysis/arraymerge.ll b/test/Transforms/DSAnalysis/arraymerge.ll
new file mode 100644
index 0000000000..2d0a577bc4
--- /dev/null
+++ b/test/Transforms/DSAnalysis/arraymerge.ll
@@ -0,0 +1,18 @@
+; 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.
+;
+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
+}
+