diff --git a/lib/Conversion/PolyToStandard/PolyToStandard.cpp b/lib/Conversion/PolyToStandard/PolyToStandard.cpp index 217e59e..e7a76dd 100644 --- a/lib/Conversion/PolyToStandard/PolyToStandard.cpp +++ b/lib/Conversion/PolyToStandard/PolyToStandard.cpp @@ -149,6 +149,8 @@ struct ConvertEval : public OpConversionPattern { auto lowerBound = b.create(b.getIndexType(), b.getIndexAttr(1)); auto numTermsOp = b.create(b.getIndexType(), + b.getIndexAttr(numTerms)); + auto upperBound = b.create(b.getIndexType(), b.getIndexAttr(numTerms + 1)); auto step = lowerBound; @@ -163,7 +165,7 @@ struct ConvertEval : public OpConversionPattern { auto accum = b.create(b.getI32Type(), b.getI32IntegerAttr(0)); auto loop = b.create( - lowerBound, numTermsOp, step, accum.getResult(), + lowerBound, upperBound, step, accum.getResult(), [&](OpBuilder &builder, Location loc, Value loopIndex, ValueRange loopState) { ImplicitLocOpBuilder b(op.getLoc(), builder);