[PATCH] D96030: NFC: Migrate CodeMetrics to work on InstructionCost

Sander de Smalen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 4 06:17:12 PST 2021


sdesmalen added inline comments.


================
Comment at: llvm/lib/Analysis/CodeMetrics.cpp:204
+  InstructionCost NumInstsThisBB = NumInstsProxy - NumInstsBeforeThisBB;
+  NumBBInsts[BB] = *NumInstsThisBB.getValue();
 }
----------------
FYI, the reason for dereferencing the Optional cost value returned by `getValue()` unconditionally is that if the number of instructions for a basic-block cannot be costed, the cost-model is broken, which should never happen.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D96030/new/

https://reviews.llvm.org/D96030



More information about the llvm-commits mailing list