https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65773
--- Comment #3 from Bill Schmidt <wschmidt at gcc dot gnu.org> --- Created attachment 35322 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35322&action=edit Unreduced save-temps file AArch64InstrInfo.ii.gz Attaching the (unreduced and compressed) preprocessed source. So far I haven't been able to reduce it. The incorrect code generation can be reproduced with: $ g++ -O2 -std=c++11 -S AArch64InstrInfo.ii or with $ g++ -O1 -std=c++11 -S AArch64InstrInfo.ii At -O0, there are no calls to _ZN4llvm12MachineInstr10addOperandERNS_15MachineFunctionERKNS_14MachineOperandE in the text of the caller, so inlining must be present. All calls to this function have reasonable setup code for r3, so -O1 is the minimum optimization level required to reproduce. The bad code may be found in the function _ZNK4llvm16AArch64InstrInfo20\ loadRegFromStackSlotERNS_17MachineBasicBlockENS1_15bundle_iteratorINS_12Machine\ InstrENS_14ilist_iteratorIS4_EEEEjiPKNS_19TargetRegisterClassEPKNS_18TargetRegi\ sterInfoE, at the third call to _ZN4llvm12MachineInstr10addOperandERNS_15MachineFunctionERKNS_14MachineOperandE.