Skip to content

Commit

Permalink
[CodeGen] allow printing of zero latency in sched comments
Browse files Browse the repository at this point in the history
I don't know how to expose this in a test. There are ARM / AArch64 
sched classes that include zero latency instructions, but I'm not 
seeing sched info printed for those targets. X86 will almost 
certainly have these soon (see PR36671), but no model has
'let Latency = 0' currently.

llvm-svn: 327518
  • Loading branch information
rotateright committed Mar 14, 2018
1 parent 36e34a9 commit 5773ac3
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions llvm/lib/CodeGen/TargetSubtargetInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,15 @@ bool TargetSubtargetInfo::useAA() const {
}

static std::string createSchedInfoStr(unsigned Latency,
Optional<double> RThroughput) {
Optional<double> RThroughput) {
static const char *SchedPrefix = " sched: [";
std::string Comment;
raw_string_ostream CS(Comment);
if (Latency > 0 && RThroughput.hasValue())
if (RThroughput.hasValue())
CS << SchedPrefix << Latency << format(":%2.2f", RThroughput.getValue())
<< "]";
else if (Latency > 0)
else
CS << SchedPrefix << Latency << ":?]";
else if (RThroughput.hasValue())
CS << SchedPrefix << "?:" << RThroughput.getValue() << "]";
CS.flush();
return Comment;
}
Expand Down

0 comments on commit 5773ac3

Please sign in to comment.