llvm-6502/test/Transforms/FunctionAttrs/2009-01-02-LocalStores.ll
Duncan Sands 338cd6ba6e 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
2009-01-02 11:54:37 +00:00

24 lines
606 B
LLVM

; 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
}