[all-commits] [llvm/llvm-project] 9468de: TargetInstrInfo: make getOperandLatency return opt...

Ramkumar Ramachandra via All-commits all-commits at lists.llvm.org
Fri Dec 1 03:29:35 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9468de48fcd413aa0895a78bd6f1aeb161b39294
      https://github.com/llvm/llvm-project/commit/9468de48fcd413aa0895a78bd6f1aeb161b39294
  Author: Ramkumar Ramachandra <Ramkumar.Ramachandra at imgtec.com>
  Date:   2023-12-01 (Fri, 01 Dec 2023)

  Changed paths:
    M llvm/include/llvm/CodeGen/TargetInstrInfo.h
    M llvm/include/llvm/MC/MCInstrItineraries.h
    M llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp
    M llvm/lib/CodeGen/TargetInstrInfo.cpp
    M llvm/lib/CodeGen/TargetSchedule.cpp
    M llvm/lib/MC/MCDisassembler/Disassembler.cpp
    M llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp
    M llvm/lib/Target/ARM/ARMBaseInstrInfo.h
    M llvm/lib/Target/Hexagon/HexagonInstrInfo.cpp
    M llvm/lib/Target/Hexagon/HexagonInstrInfo.h
    M llvm/lib/Target/Hexagon/HexagonSubtarget.cpp
    M llvm/lib/Target/PowerPC/PPCInstrInfo.cpp
    M llvm/lib/Target/PowerPC/PPCInstrInfo.h

  Log Message:
  -----------
  TargetInstrInfo: make getOperandLatency return optional (NFC) (#73769)

getOperandLatency has the following behavior: it returns -1 as a special
value, negative numbers other than -1 on some target-specific overrides,
or a valid non-negative latency. This behavior can be surprising, as
some callers do arithmetic on these negative values. Change the
interface of getOperandLatency to return a std::optional<unsigned> to
prevent surprises in callers. While at it, change the interface of
getInstrLatency to return unsigned instead of int.

This change was inspired by a refactoring in
TargetSchedModel::computeOperandLatency.




More information about the All-commits mailing list