File tree Expand file tree Collapse file tree 2 files changed +5
-8
lines changed
lib/Conversion/VectorToLLVM
test/Conversion/VectorToLLVM Expand file tree Collapse file tree 2 files changed +5
-8
lines changed Original file line number Diff line number Diff line change @@ -1118,17 +1118,14 @@ class VectorExtractOpConversion
1118
1118
// Since the LLVM type converter converts 0-d vectors to 1-d vectors, we
1119
1119
// need to add a position for this change.
1120
1120
if (extractOp.getSourceVectorType ().getRank () == 0 ) {
1121
- auto idxType = rewriter.getIndexType ();
1122
- Value position = rewriter.create <LLVM::ConstantOp>(
1123
- loc, typeConverter->convertType (idxType),
1124
- rewriter.getIntegerAttr (idxType, 0 ));
1125
- positionVec.push_back (position);
1121
+ Type idxType = typeConverter->convertType (rewriter.getIndexType ());
1122
+ positionVec.push_back (rewriter.getZeroAttr (idxType));
1126
1123
}
1127
1124
1128
1125
Value extracted = adaptor.getVector ();
1129
- if (extractsScalar ) {
1126
+ if (extractsAggregate ) {
1130
1127
ArrayRef<OpFoldResult> position (positionVec);
1131
- if (extractsAggregate ) {
1128
+ if (extractsScalar ) {
1132
1129
// If we are extracting a scalar from the extracted member, we drop
1133
1130
// the last index, which will be used to extract the scalar out of the
1134
1131
// vector.
Original file line number Diff line number Diff line change @@ -1344,7 +1344,7 @@ func.func @extract_scalar_from_vec_0d_index(%arg0: vector<index>) -> index {
1344
1344
// CHECK-LABEL: @extract_scalar_from_vec_0d_index(
1345
1345
// CHECK-SAME: %[[A:.*]]: vector<index>)
1346
1346
// CHECK: %[[T0:.*]] = builtin.unrealized_conversion_cast %[[A]] : vector<index> to vector<1xi64>
1347
- // CHECK: %[[T1:.*]] = llvm.mlir.constant(0 : index ) : i64
1347
+ // CHECK: %[[T1:.*]] = llvm.mlir.constant(0 : i64 ) : i64
1348
1348
// CHECK: %[[T2:.*]] = llvm.extractelement %[[T0]][%[[T1]] : i64] : vector<1xi64>
1349
1349
// CHECK: %[[T3:.*]] = builtin.unrealized_conversion_cast %[[T2]] : i64 to index
1350
1350
// CHECK: return %[[T3]] : index
You can’t perform that action at this time.
0 commit comments