mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-02 07:17:36 +00:00
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/trunk@235524 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -40,7 +40,8 @@ bool AMDGPUAlwaysInline::runOnModule(Module &M) {
|
|||||||
std::vector<Function*> FuncsToClone;
|
std::vector<Function*> FuncsToClone;
|
||||||
for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) {
|
for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) {
|
||||||
Function &F = *I;
|
Function &F = *I;
|
||||||
if (!F.hasLocalLinkage() && !F.isDeclaration() && !F.use_empty())
|
if (!F.hasLocalLinkage() && !F.isDeclaration() && !F.use_empty() &&
|
||||||
|
!F.hasFnAttribute(Attribute::NoInline))
|
||||||
FuncsToClone.push_back(&F);
|
FuncsToClone.push_back(&F);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,7 +55,7 @@ bool AMDGPUAlwaysInline::runOnModule(Module &M) {
|
|||||||
|
|
||||||
for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) {
|
for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) {
|
||||||
Function &F = *I;
|
Function &F = *I;
|
||||||
if (F.hasLocalLinkage()) {
|
if (F.hasLocalLinkage() && !F.hasFnAttribute(Attribute::NoInline)) {
|
||||||
F.addFnAttr(Attribute::AlwaysInline);
|
F.addFnAttr(Attribute::AlwaysInline);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,16 @@
|
|||||||
|
|
||||||
declare i32 @external_function(i32) nounwind
|
declare i32 @external_function(i32) nounwind
|
||||||
|
|
||||||
|
define void @test_call_external(i32 addrspace(1)* %out, i32 addrspace(1)* %in) {
|
||||||
|
%b_ptr = getelementptr i32, i32 addrspace(1)* %in, i32 1
|
||||||
|
%a = load i32, i32 addrspace(1)* %in
|
||||||
|
%b = load i32, i32 addrspace(1)* %b_ptr
|
||||||
|
%c = call i32 @external_function(i32 %b) nounwind
|
||||||
|
%result = add i32 %a, %c
|
||||||
|
store i32 %result, i32 addrspace(1)* %out
|
||||||
|
ret void
|
||||||
|
}
|
||||||
|
|
||||||
define i32 @defined_function(i32 %x) nounwind noinline {
|
define i32 @defined_function(i32 %x) nounwind noinline {
|
||||||
%y = add i32 %x, 8
|
%y = add i32 %x, 8
|
||||||
ret i32 %y
|
ret i32 %y
|
||||||
@@ -21,14 +31,3 @@ define void @test_call(i32 addrspace(1)* %out, i32 addrspace(1)* %in) {
|
|||||||
store i32 %result, i32 addrspace(1)* %out
|
store i32 %result, i32 addrspace(1)* %out
|
||||||
ret void
|
ret void
|
||||||
}
|
}
|
||||||
|
|
||||||
define void @test_call_external(i32 addrspace(1)* %out, i32 addrspace(1)* %in) {
|
|
||||||
%b_ptr = getelementptr i32, i32 addrspace(1)* %in, i32 1
|
|
||||||
%a = load i32, i32 addrspace(1)* %in
|
|
||||||
%b = load i32, i32 addrspace(1)* %b_ptr
|
|
||||||
%c = call i32 @external_function(i32 %b) nounwind
|
|
||||||
%result = add i32 %a, %c
|
|
||||||
store i32 %result, i32 addrspace(1)* %out
|
|
||||||
ret void
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user