File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -599,7 +599,13 @@ RESULT_TYPE getScalarValue(ElementsAttr denseAttr, Type type) {
599599 if (elementaryType.isInteger (8 ) || elementaryType.isInteger (16 ) ||
600600 elementaryType.isInteger (32 ) || elementaryType.isInteger (64 )) {
601601 auto valueIt = denseAttr.getValues <IntegerAttr>().begin ();
602- return static_cast <RESULT_TYPE>(mlir::cast<IntegerAttr>(*valueIt).getInt ());
602+ if (type.isSignedInteger ()) {
603+ return static_cast <RESULT_TYPE>(
604+ mlir::cast<IntegerAttr>(*valueIt).getSInt ());
605+ } else {
606+ return static_cast <RESULT_TYPE>(
607+ mlir::cast<IntegerAttr>(*valueIt).getUInt ());
608+ }
603609 } else if (mlir::isa<FloatType>(elementaryType)) {
604610 auto valueIt = denseAttr.getValues <APFloat>().begin ();
605611 return static_cast <RESULT_TYPE>((*valueIt).convertToDouble ());
You can’t perform that action at this time.
0 commit comments