[llvm] [LV][NFC] Factor out MinBWs of values from the cost model (PR #194492)

Hassnaa Hamdi via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 29 05:16:21 PDT 2026


================
@@ -5507,10 +5495,10 @@ LoopVectorizationCostModel::getInstructionCost(Instruction *I,
       [[maybe_unused]] Instruction *Op0AsInstruction =
           dyn_cast<Instruction>(I->getOperand(0));
       assert((!canTruncateToMinimalBitwidth(Op0AsInstruction, VF) ||
-              MinBWs[I] == MinBWs[Op0AsInstruction]) &&
+              InstrMinBWs == MinBWs.lookup(Op0AsInstruction)) &&
----------------
hassnaaHamdi wrote:

The `operator[]` returns a reference, and I'm using const map here `getMinimalBitwidths` that's why I used the `lookup` which returns by value. Previously the map was a member var of the CM that's why it was okay to use `MinBWs[Op0AsInstruction]`

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


More information about the llvm-commits mailing list