aboutsummaryrefslogtreecommitdiffstats
path: root/test/Transforms/FunctionAttrs
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2009-01-02 11:54:37 +0000
committerDuncan Sands <baldrick@free.fr>2009-01-02 11:54:37 +0000
commit338cd6ba6e36c291185541bb8e391427f57a32b1 (patch)
treee6bd73b479b2e4823f0becbbf83856819841202d /test/Transforms/FunctionAttrs
parentb2f2279056ab9e2e80f94c20d79affc007a4de62 (diff)
downloadexternal_llvm-338cd6ba6e36c291185541bb8e391427f57a32b1.zip
external_llvm-338cd6ba6e36c291185541bb8e391427f57a32b1.tar.gz
external_llvm-338cd6ba6e36c291185541bb8e391427f57a32b1.tar.bz2
When calculating 'nocapture' argument attributes, allow
the argument to be stored to an alloca by tracking uses of the alloca. This occurs 4 times (out of 7121, 0.05%) in MultiSource/Applications, so may not be worth it. On the other hand, it is easy to do and fairly cheap. The functions it helps are: W_addcom and W_addlit in spiff; process_args (argv) in d (make_dparser); ercPixConcealIMB in JM/ldecod. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61570 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/FunctionAttrs')
-rw-r--r--test/Transforms/FunctionAttrs/2009-01-02-LocalStores.ll23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/Transforms/FunctionAttrs/2009-01-02-LocalStores.ll b/test/Transforms/FunctionAttrs/2009-01-02-LocalStores.ll
new file mode 100644
index 0000000..17b4439
--- /dev/null
+++ b/test/Transforms/FunctionAttrs/2009-01-02-LocalStores.ll
@@ -0,0 +1,23 @@
+; RUN: llvm-as < %s | opt -functionattrs | llvm-dis | not grep {nocapture *%%q}
+; RUN: llvm-as < %s | opt -functionattrs | llvm-dis | grep {nocapture *%%p}
+
+@g = external global i32**
+
+define i32 @f(i32* %p, i32* %q) {
+ %a1 = alloca i32*
+ %a2 = alloca i32**
+ store i32* %p, i32** %a1
+ store i32** %a1, i32*** %a2
+ %reload1 = load i32*** %a2
+ %reload2 = load i32** %reload1
+ %load_p = load i32* %reload2
+ store i32 0, i32* %reload2
+
+ %b1 = alloca i32*
+ %b2 = alloca i32**
+ store i32* %q, i32** %b1
+ store i32** %b1, i32*** %b2
+ %reload3 = load i32*** %b2
+ store i32** %reload3, i32*** @g
+ ret i32 %load_p
+}