Balaram Makam
2015-Mar-25 20:43 UTC
[LLVMdev] [Inliner] passing inline hint to optimizer if it appears explicitly on declaration
All, I explicitly pass inline hint to the function declaration of foo<int>::add() as in the following example: #cat example.cpp template <class T> class foo { public: T* tp; int elem; int maxelem; T* add(); }; template <class T> inline T* foo <T>::add() { if (elem!=maxelem) elem++; return tp+elem-1; } typedef foo <int> intboundart; class bar { void addtobound(intboundart& boundarp); }; void bar::addtobound(intboundart& barp) { barp.add(); } Yet the IR passed into optimizer doesn't contain inlinehint attribute: #clang -cc1 -emit-llvm -o - example.cpp <snip> ; Function Attrs: nounwind define linkonce_odr i32* @_ZN3fooIiE3addEv(%class.foo* %this) #0 comdat align 2 { <snip> Clang will pass inline hint to optimizer only if I declare explicitly in the class like this: template <class T> class foo { public: T* tp; int elem; int maxelem; inline T* add(); }; Isn't this a clang bug? Any pointers on how to fix this? Thanks, Balaram -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150325/9f2d317d/attachment.html>