Index: lib/CodeGen/AsmPrinter/AsmPrinter.cpp =================================================================== --- lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -742,10 +742,11 @@ } /// emitComments - Pretty-print comments for instructions. -static void emitComments(const MachineInstr &MI, raw_ostream &CommentOS, +static bool emitComments(const MachineInstr &MI, raw_ostream &CommentOS, AsmPrinter *AP) { const MachineFunction *MF = MI.getMF(); const TargetInstrInfo *TII = MF->getSubtarget().getInstrInfo(); + bool Result = false; // Check for spills and reloads int FI; @@ -786,12 +787,15 @@ CommentOS << " Reload Reuse"; } - if (Commented && AP->EnablePrintSchedInfo) + if (Commented && AP->EnablePrintSchedInfo) { // If any comment was added above and we need sched info comment then // add this new comment just after the above comment w/o "\n" between them. CommentOS << " " << MF->getSubtarget().getSchedInfoStr(MI) << "\n"; + Result = true; + } else if (Commented) CommentOS << "\n"; + return Result; } /// emitImplicitDef - This method emits the specified machine instruction @@ -1034,7 +1038,11 @@ } if (isVerbose()) - emitComments(MI, OutStreamer->GetCommentOS(), this); + if(emitComments(MI, OutStreamer->GetCommentOS(), this)) { + MachineInstr *MIP = const_cast(&MI); + unsigned F = MI.getFlags() | 32; //X86::IP_NO_SCHED_INFO; + MIP->setFlags (F); + } switch (MI.getOpcode()) { case TargetOpcode::CFI_INSTRUCTION: Index: lib/Target/X86/MCTargetDesc/X86BaseInfo.h =================================================================== --- lib/Target/X86/MCTargetDesc/X86BaseInfo.h +++ lib/Target/X86/MCTargetDesc/X86BaseInfo.h @@ -59,7 +59,8 @@ IP_HAS_AD_SIZE = 2, IP_HAS_REPEAT_NE = 4, IP_HAS_REPEAT = 8, - IP_HAS_LOCK = 16 + IP_HAS_LOCK = 16, + IP_NO_SCHED_INFO = 32 }; } // end namespace X86; Index: lib/Target/X86/X86MCInstLower.cpp =================================================================== --- lib/Target/X86/X86MCInstLower.cpp +++ lib/Target/X86/X86MCInstLower.cpp @@ -103,7 +103,8 @@ } void X86AsmPrinter::EmitAndCountInstruction(MCInst &Inst) { - OutStreamer->EmitInstruction(Inst, getSubtargetInfo(), EnablePrintSchedInfo); + OutStreamer->EmitInstruction(Inst, getSubtargetInfo(), + EnablePrintSchedInfo & !(Inst.getFlags() & 32)); SMShadowTracker.count(Inst, getSubtargetInfo(), CodeEmitter.get()); } @@ -2003,6 +2004,7 @@ MCInst TmpInst; MCInstLowering.Lower(MI, TmpInst); + TmpInst.setFlags(MI->getFlags()); // Stackmap shadows cannot include branch targets, so we can count the bytes // in a call towards the shadow, but must ensure that the no thread returns Index: test/CodeGen/X86/avx512-schedule.ll =================================================================== --- test/CodeGen/X86/avx512-schedule.ll +++ test/CodeGen/X86/avx512-schedule.ll @@ -8835,10 +8835,8 @@ ; GENERIC-NEXT: .cfi_def_cfa_offset 32 ; GENERIC-NEXT: vaddss %xmm0, %xmm0, %xmm0 # sched: [3:1.00] ; GENERIC-NEXT: vmovaps %xmm0, (%rsp) # 16-byte Spill sched: [5:1.00] -; GENERIC-NEXT: # sched: [5:1.00] ; GENERIC-NEXT: callq func_f32 ; GENERIC-NEXT: vbroadcastss (%rsp), %zmm0 # 16-byte Folded Reload sched: [5:1.00] -; GENERIC-NEXT: # sched: [5:1.00] ; GENERIC-NEXT: addq $24, %rsp # sched: [1:0.33] ; GENERIC-NEXT: retq # sched: [1:1.00] ; @@ -8848,10 +8846,8 @@ ; SKX-NEXT: .cfi_def_cfa_offset 32 ; SKX-NEXT: vaddss %xmm0, %xmm0, %xmm0 # sched: [4:0.33] ; SKX-NEXT: vmovaps %xmm0, (%rsp) # 16-byte Spill sched: [1:1.00] -; SKX-NEXT: # sched: [1:1.00] ; SKX-NEXT: callq func_f32 ; SKX-NEXT: vbroadcastss (%rsp), %zmm0 # 16-byte Folded Reload sched: [8:0.50] -; SKX-NEXT: # sched: [8:0.50] ; SKX-NEXT: addq $24, %rsp # sched: [1:0.25] ; SKX-NEXT: retq # sched: [7:1.00] %a = fadd float %x, %x @@ -8869,10 +8865,8 @@ ; GENERIC-NEXT: .cfi_def_cfa_offset 32 ; GENERIC-NEXT: vaddsd %xmm0, %xmm0, %xmm0 # sched: [3:1.00] ; GENERIC-NEXT: vmovapd %xmm0, (%rsp) # 16-byte Spill sched: [5:1.00] -; GENERIC-NEXT: # sched: [5:1.00] ; GENERIC-NEXT: callq func_f64 ; GENERIC-NEXT: vbroadcastsd (%rsp), %zmm0 # 16-byte Folded Reload sched: [5:1.00] -; GENERIC-NEXT: # sched: [5:1.00] ; GENERIC-NEXT: addq $24, %rsp # sched: [1:0.33] ; GENERIC-NEXT: retq # sched: [1:1.00] ; @@ -8882,10 +8876,8 @@ ; SKX-NEXT: .cfi_def_cfa_offset 32 ; SKX-NEXT: vaddsd %xmm0, %xmm0, %xmm0 # sched: [4:0.33] ; SKX-NEXT: vmovapd %xmm0, (%rsp) # 16-byte Spill sched: [1:1.00] -; SKX-NEXT: # sched: [1:1.00] ; SKX-NEXT: callq func_f64 ; SKX-NEXT: vbroadcastsd (%rsp), %zmm0 # 16-byte Folded Reload sched: [8:0.50] -; SKX-NEXT: # sched: [8:0.50] ; SKX-NEXT: addq $24, %rsp # sched: [1:0.25] ; SKX-NEXT: retq # sched: [7:1.00] %a = fadd double %x, %x