https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85961
--- Comment #2 from bki at hacon dot de --- (In reply to Richard Biener from comment #1) > To me it shoulds you are messing with the ABI behind GCCs back. True. I'd still argue that the SysV-ABI suggests that a caller would need to save and restore %rsi before/after a normal function call. But you are right in that the function _ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6lengthEv.isra.0 is not 'normal' in this case but completely in the hands of the compiler (who does not clobber rsi). I could rework my messing with the ABI to change fewer registers but since that is very performance sensitive code, I'd like to understand better if it is really necessary. > We use IPA > register allocation to do this kind of transform that of course doesn't work > if you do this. > > So - does -fno-ipa-ra fix this for you? No, I get the same instruction sequence with '-fno-ipa-ra'