Skip to content

Commit 8c3d5c7

Browse files
committed
add comments
1 parent bdeccd9 commit 8c3d5c7

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

mlir/lib/Conversion/ArithToLLVM/ArithToLLVM.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ struct ConstrainedVectorConvertToLLVMPattern
5454
}
5555
};
5656

57-
/// No-op bitcast.
57+
/// No-op bitcast. Propagate type input arg if converted source and dest types
58+
/// are the same.
5859
struct IdentityBitcastLowering final
5960
: public OpConversionPattern<arith::BitcastOp> {
6061
using OpConversionPattern::OpConversionPattern;
@@ -63,7 +64,8 @@ struct IdentityBitcastLowering final
6364
matchAndRewrite(arith::BitcastOp op, OpAdaptor adaptor,
6465
ConversionPatternRewriter &rewriter) const final {
6566
Value src = adaptor.getIn();
66-
if (src.getType() != getTypeConverter()->convertType(op.getType()))
67+
Type resultType = getTypeConverter()->convertType(op.getType());
68+
if (src.getType() != resultType)
6769
return rewriter.notifyMatchFailure(op, "Types are different");
6870

6971
rewriter.replaceOp(op, src);

mlir/lib/Conversion/LLVMCommon/VectorPattern.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ LogicalResult LLVM::detail::handleMultidimensionalVectors(
104104
}
105105

106106
static bool isVectorCompatibleType(Type type) {
107+
// Limit `vectorOneToOneRewrite` to scalar and vector types (and to
108+
// `LLVM::LLVMArrayType` which have a special handling).
107109
return isa<LLVM::LLVMArrayType, VectorType, IntegerType, FloatType>(type) &&
108110
LLVM::isCompatibleType(type);
109111
}

0 commit comments

Comments
 (0)