Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7c7c3d4

Browse files
andrey-golubevovidiup-movidius
authored andcommitted
[ODS][NFC] Cast range.size() to int32_t in accumulation (llvm#85629)
Using range.size() "as is" means we accumulate 'size_t' values into 'int32_t' variable. This may produce narrowing conversion warnings (particularly, on MSVC). The surrounding code seems to cast <x>.size() to 'int32_t' so following this practice seems safe enough. Co-authored-by: Ovidiu Pintican <[email protected]> (cherry picked from commit bce1703)
1 parent 0e501db commit 7c7c3d4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -3058,7 +3058,7 @@ void OpEmitter::genCodeForAddingArgAndRegionForBuilder(
30583058
body << llvm::formatv(
30593059
"static_cast<int32_t>(std::accumulate({0}.begin(), {0}.end(), 0, "
30603060
"[](int32_t curSum, ::mlir::ValueRange range) {{ return curSum + "
3061-
"range.size(); }))",
3061+
"static_cast<int32_t>(range.size()); }))",
30623062
operandName);
30633063
} else {
30643064
body << "static_cast<int32_t>(" << getArgumentName(op, i) << ".size())";

0 commit comments

Comments
 (0)