Unverified Commit b7e09d40 authored by Scott Cyphers's avatar Scott Cyphers Committed by GitHub

[MLIR] Fix overwriting of value (#4434)

* Fix overwriting of value

* style

* Style
parent 976103eb
...@@ -2011,6 +2011,7 @@ namespace ...@@ -2011,6 +2011,7 @@ namespace
auto pAllIVs = makeHandlePointers(allIVs); auto pAllIVs = makeHandlePointers(allIVs);
auto steps = vArg.getSteps(); auto steps = vArg.getSteps();
SmallVector<ValueHandle, 8> nonRedIVs; SmallVector<ValueHandle, 8> nonRedIVs;
SmallVector<ValueHandle, 8> tempIVs;
Type resTy = result.getType().cast<MemRefType>().getElementType(); Type resTy = result.getType().cast<MemRefType>().getElementType();
NGRAPH_CHECK(resTy.isa<IntegerType>(), NGRAPH_CHECK(resTy.isa<IntegerType>(),
...@@ -2032,8 +2033,17 @@ namespace ...@@ -2032,8 +2033,17 @@ namespace
(ValueHandle)iRes(nonRedIVs), IndexType::get(resTy.getContext())); (ValueHandle)iRes(nonRedIVs), IndexType::get(resTy.getContext()));
// Build list of IVs including current min index. // Build list of IVs including current min index.
auto tempIVs = allIVs; for (auto i = 0; i < vArg.rank(); i++)
tempIVs[axis] = currRedIdx; {
if (i != axis)
{
tempIVs.push_back(allIVs[i]);
}
else
{
tempIVs.push_back(currRedIdx);
}
}
// Select the min/max value and cast it back to integer type before storing it. // Select the min/max value and cast it back to integer type before storing it.
ValueHandle newRedIdx = ValueHandle newRedIdx =
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment