From a816f42e4da693f2e749b855da55d7bb4e4ccad4 Mon Sep 17 00:00:00 2001 From: Sanjay Patel Date: Wed, 14 Mar 2018 15:28:48 +0000 Subject: [PATCH] [CodeGen] allow printing of zero latency in sched comments 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327518 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/TargetSubtargetInfo.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/CodeGen/TargetSubtargetInfo.cpp b/lib/CodeGen/TargetSubtargetInfo.cpp index a72d7ebaed4..0d7940d767c 100644 --- a/lib/CodeGen/TargetSubtargetInfo.cpp +++ b/lib/CodeGen/TargetSubtargetInfo.cpp @@ -68,17 +68,15 @@ bool TargetSubtargetInfo::useAA() const { } static std::string createSchedInfoStr(unsigned Latency, - Optional RThroughput) { + Optional 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; } -- 2.11.0