[PATCH] D100565: [TTI] NFC: Change getIntImmCost[Inst|Intrin] to return InstructionCost

Christopher Tetreault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 19 09:45:27 PDT 2021


ctetreau added a comment.

Assuming @c-rhodes is satisfied, this change looks good to me.



================
Comment at: llvm/lib/Transforms/Scalar/ConstantHoisting.cpp:390
     }
-    ConstIntCandVec[Itr->second].addUser(Inst, Idx, Cost);
+    ConstIntCandVec[Itr->second].addUser(Inst, Idx, *Cost.getValue());
     LLVM_DEBUG(if (isa<ConstantInt>(Inst->getOperand(Idx))) dbgs()
----------------
c-rhodes wrote:
> Does there need to be a check the cost is valid before calling `getValue`?
Code that handles the invalid case would be a functional change. This follows the philosophy of "the code previously assumed all costs are valid, so we will assume it's valid now and handle the crashes in future functional changes patches if we see them"


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100565



More information about the llvm-commits mailing list