[llvm] TargetInstrInfo: make getOperandLatency return optional (NFC) (PR #73769)

Francesco Petrogalli via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 1 00:31:27 PST 2023


================
@@ -4070,11 +4064,11 @@ ARMBaseInstrInfo::getOperandLatency(const InstrItineraryData *ItinData,
     break;
   }
 
-  if (DefCycle == -1)
+  if (!DefCycle)
     // We can't seem to determine the result latency of the def, assume it's 2.
     DefCycle = 2;
 
-  int UseCycle = -1;
+  std::optional<unsigned> UseCycle = std::nullopt;
----------------
fpetrogalli wrote:

Same:
```suggestion
  std::optional<unsigned> UseCycle;
```

https://github.com/llvm/llvm-project/pull/73769


More information about the llvm-commits mailing list