laxmansole added a comment. In https://reviews.llvm.org/D22782#495436, @mclow.lists wrote:
> Do we have a test for the problem that this is solving? $ cat foo.cpp int foo(const std::string name); int main(){ return foo("bar"); } $clang++ -S -O3 -fno-exceptions foo.cpp Assembly output without patch: _Z3barv: // @_Z3barv // BB#0: // %entry sub sp, sp, #64 // =64 adrp x1, .L.str add x1, x1, :lo12:.L.str add x0, sp, #8 // =8 orr w2, wzr, #0x3 stp xzr, x19, [sp, #24] // 8-byte Folded Spill stp x29, x30, [sp, #48] // 8-byte Folded Spill add x29, sp, #48 // =48 stp xzr, xzr, [sp, #8] bl _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6__initEPKcm add x0, sp, #8 // =8 bl _Z3fooNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE and w19, w0, #0x1 add x0, sp, #8 // =8 bl _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEED1Ev mov w0, w19 ldp x29, x30, [sp, #48] // 8-byte Folded Reload ldr x19, [sp, #32] // 8-byte Folded Reload add sp, sp, #64 // =64 ret Assembly output with path: _Z3barv: // @_Z3barv // BB#0: // %entry sub sp, sp, #64 // =64 orr w8, wzr, #0x6 mov w9, #114 mov w10, #24930 add x0, sp, #8 // =8 stp xzr, x19, [sp, #24] // 8-byte Folded Spill stp x29, x30, [sp, #48] // 8-byte Folded Spill add x29, sp, #48 // =48 stp xzr, xzr, [sp, #8] strb w8, [sp, #8] strb w9, [sp, #11] sturh w10, [sp, #9] strb wzr, [sp, #12] bl _Z3fooNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE and w19, w0, #0x1 add x0, sp, #8 // =8 bl _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEED1Ev mov w0, w19 ldp x29, x30, [sp, #48] // 8-byte Folded Reload ldr x19, [sp, #32] // 8-byte Folded Reload add sp, sp, #64 // =64 ret We can see that call to _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6__initEPKcm get inlined. https://reviews.llvm.org/D22782 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits