[llvm] 70040de - [MCA][TimelineView] Fixed a bug that was causing instructions outside of the timeline-max-cycles to still be printed.

Patrick Holland via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 23 15:10:58 PDT 2021


Author: Patrick Holland
Date: 2021-06-23T15:05:49-07:00
New Revision: 70040de32d73683938abef72515b736c5b6e68dc

URL: https://github.com/llvm/llvm-project/commit/70040de32d73683938abef72515b736c5b6e68dc
DIFF: https://github.com/llvm/llvm-project/commit/70040de32d73683938abef72515b736c5b6e68dc.diff

LOG: [MCA][TimelineView] Fixed a bug that was causing instructions outside of the timeline-max-cycles to still be printed.

Differential Revision: https://reviews.llvm.org/D104815

Added: 
    

Modified: 
    llvm/tools/llvm-mca/Views/TimelineView.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/tools/llvm-mca/Views/TimelineView.cpp b/llvm/tools/llvm-mca/Views/TimelineView.cpp
index 5cd163cad018..df536b46e7a9 100644
--- a/llvm/tools/llvm-mca/Views/TimelineView.cpp
+++ b/llvm/tools/llvm-mca/Views/TimelineView.cpp
@@ -288,6 +288,15 @@ void TimelineView::printTimeline(raw_ostream &OS) const {
   for (unsigned Iteration = 0; Iteration < Iterations; ++Iteration) {
     for (const MCInst &Inst : Source) {
       const TimelineViewEntry &Entry = Timeline[IID];
+      // When an instruction is retired after timeline-max-cycles,
+      // its CycleRetired is left at 0. However, it's possible for
+      // a 0 latency instruction to be retired during cycle 0 and we
+      // don't want to early exit in that case. The CycleExecuted
+      // attribute is set correctly whether or not it is greater
+      // than timeline-max-cycles so we can use that to ensure
+      // we don't early exit because of a 0 latency instruction.
+      if (Entry.CycleRetired == 0 && Entry.CycleExecuted != 0)
+        return;
 
       unsigned SourceIndex = IID % Source.size();
       printTimelineViewEntry(FOS, Entry, Iteration, SourceIndex);


        


More information about the llvm-commits mailing list