llvm.org GIT mirror llvm / 4c7e68a
Merging r235524: ------------------------------------------------------------------------ r235524 | Matthew.Arsenault | 2015-04-22 13:10:44 -0400 (Wed, 22 Apr 2015) | 4 lines R600: Fix always inline pass breaking noinline functions No test since calls are not actually supported yet. ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_36@236448 91177308-0d34-0410-b5e6-96231b3b80d8 Tom Stellard 4 years ago
2 changed file(s) with 13 addition(s) and 13 deletion(s). Raw diff Collapse all Expand all
3939 std::vector FuncsToClone;
4040 for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) {
4141 Function &F = *I;
42 if (!F.hasLocalLinkage() && !F.isDeclaration() && !F.use_empty())
42 if (!F.hasLocalLinkage() && !F.isDeclaration() && !F.use_empty() &&
43 !F.hasFnAttribute(Attribute::NoInline))
4344 FuncsToClone.push_back(&F);
4445 }
4546
5354
5455 for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) {
5556 Function &F = *I;
56 if (F.hasLocalLinkage()) {
57 if (F.hasLocalLinkage() && !F.hasFnAttribute(Attribute::NoInline)) {
5758 F.addFnAttr(Attribute::AlwaysInline);
5859 }
5960 }
55
66
77 declare i32 @external_function(i32) nounwind
8
9 define void @test_call_external(i32 addrspace(1)* %out, i32 addrspace(1)* %in) {
10 %b_ptr = getelementptr i32 addrspace(1)* %in, i32 1
11 %a = load i32 addrspace(1)* %in
12 %b = load i32 addrspace(1)* %b_ptr
13 %c = call i32 @external_function(i32 %b) nounwind
14 %result = add i32 %a, %c
15 store i32 %result, i32 addrspace(1)* %out
16 ret void
17 }
818
919 define i32 @defined_function(i32 %x) nounwind noinline {
1020 %y = add i32 %x, 8
2030 store i32 %result, i32 addrspace(1)* %out
2131 ret void
2232 }
23
24 define void @test_call_external(i32 addrspace(1)* %out, i32 addrspace(1)* %in) {
25 %b_ptr = getelementptr i32 addrspace(1)* %in, i32 1
26 %a = load i32 addrspace(1)* %in
27 %b = load i32 addrspace(1)* %b_ptr
28 %c = call i32 @external_function(i32 %b) nounwind
29 %result = add i32 %a, %c
30 store i32 %result, i32 addrspace(1)* %out
31 ret void
32 }
33