http://llvm.org/bugs/show_bug.cgi?id=4884
Summary: function attributes of template methods of template
classes are ignored
Product: tools
Version: 2.6
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P2
Component: llvm-g++
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected]
test case:
template<typename X> X bar(X x) __attribute__((noinline));
template<typename X> X bar(X x) { return x + 1; }
template <typename S> class Bar {
public:
S s;
Bar() : s(1) {}
template<typename X> X bar(X x) __attribute__((noinline));
};
template <typename S>
template<typename X> X Bar<S>::bar(X x) { return x + 1 + s; }
int test()
{
int a = bar((int)1);
Bar<int> bar;
int b = bar.bar((int)1);
return a + b;
}
llvm-g++ -emit-llvm -o foo.bc foo.cpp -O3 -c yields:
efine i32 @_Z4testv() nounwind {
entry:
%0 = tail call i32 @_Z3barIiET_S0_(i32 1) nounwind ; <i32> [#uses=1]
%1 = add nsw i32 %0, 3 ; <i32> [#uses=1]
ret i32 %1
}
define linkonce_odr i32 @_Z3barIiET_S0_(i32 %x) nounwind readnone noinline {
entry:
%0 = add nsw i32 %x, 1 ; <i32> [#uses=1]
ret i32 %0
}
Bar<S>::bar isn't marked as noinline. Likewise, there is no compiler warning
when using non-existing function attributes. It does seem to work for the
template function, though.
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs