@@ -145,7 +145,6 @@ struct ConstantTupleLowering : public OpConversionPattern<ConstantTupleOp> {
145
145
Location loc = op->getLoc ();
146
146
147
147
// Convert tuple type.
148
- assert (op->getNumResults () == 1 );
149
148
Type tupleType = op.tuple ().getType ();
150
149
Type structType = typeConverter->convertType (tupleType);
151
150
@@ -154,7 +153,6 @@ struct ConstantTupleLowering : public OpConversionPattern<ConstantTupleOp> {
154
153
155
154
// Insert values.
156
155
ArrayAttr values = op.values ();
157
- assert (values);
158
156
for (int i = 0 ; i < static_cast <int >(values.size ()); i++) {
159
157
// Create constant value op.
160
158
Attribute field = values[i];
@@ -196,8 +194,7 @@ struct PrintOpLowering : public OpConversionPattern<PrintOp> {
196
194
Location loc = op->getLoc ();
197
195
Type i32 = rewriter.getI32Type ();
198
196
199
- auto structType = adaptor.element ().getType ().dyn_cast <LLVMStructType>();
200
- assert (structType && " Only struct types supported for now" );
197
+ auto structType = adaptor.element ().getType ().cast <LLVMStructType>();
201
198
202
199
// Assemble format string in the form `(%lli, %lg, ...)`.
203
200
std::string format (" (" );
@@ -723,8 +720,7 @@ buildNextBody(MapOp op, OpBuilder &builder, Value initialState,
723
720
createExtractValueOp (b, upstreamStateType, initialState, {0 });
724
721
725
722
// Extract input element type.
726
- StreamType inputStreamType = op.input ().getType ().dyn_cast <StreamType>();
727
- assert (inputStreamType);
723
+ StreamType inputStreamType = op.input ().getType ().cast <StreamType>();
728
724
Type inputElementType = inputStreamType.getElementType ();
729
725
730
726
// Call next.
@@ -1360,9 +1356,7 @@ buildNextFuncInParentModule(Operation *originalOp, OpBuilder &builder,
1360
1356
ArrayRef<IteratorInfo> upstreamInfos) {
1361
1357
// Compute element type.
1362
1358
assert (originalOp->getNumResults () == 1 );
1363
- StreamType streamType =
1364
- originalOp->getResult (0 ).getType ().dyn_cast <StreamType>();
1365
- assert (streamType);
1359
+ StreamType streamType = originalOp->getResult (0 ).getType ().cast <StreamType>();
1366
1360
Type elementType = streamType.getElementType ();
1367
1361
1368
1362
// Build function.
0 commit comments