@@ -1211,13 +1211,13 @@ class LowerMatrixIntrinsics {
1211
1211
1212
1212
switch (Inst->getCalledFunction ()->getIntrinsicID ()) {
1213
1213
case Intrinsic::matrix_multiply:
1214
- return LowerMultiply (Inst);
1214
+ return LowerMultiply (Inst, Builder );
1215
1215
case Intrinsic::matrix_transpose:
1216
- return LowerTranspose (Inst);
1216
+ return LowerTranspose (Inst, Builder );
1217
1217
case Intrinsic::matrix_column_major_load:
1218
- return LowerColumnMajorLoad (Inst);
1218
+ return LowerColumnMajorLoad (Inst, Builder );
1219
1219
case Intrinsic::matrix_column_major_store:
1220
- return LowerColumnMajorStore (Inst);
1220
+ return LowerColumnMajorStore (Inst, Builder );
1221
1221
case Intrinsic::abs:
1222
1222
case Intrinsic::fabs: {
1223
1223
MatrixTy Result;
@@ -1312,23 +1312,23 @@ class LowerMatrixIntrinsics {
1312
1312
1313
1313
// / Lower a load instruction with shape information.
1314
1314
MatrixTy LowerLoad (Instruction *Inst, Value *Ptr, MaybeAlign Align,
1315
- Value *Stride, bool IsVolatile, ShapeInfo Shape) {
1316
- IRBuilder<> Builder (Inst);
1315
+ Value *Stride, bool IsVolatile, ShapeInfo Shape,
1316
+ IRBuilder<> & Builder) {
1317
1317
return loadMatrix (Inst->getType (), Ptr, Align, Stride, IsVolatile, Shape,
1318
1318
Builder);
1319
1319
}
1320
1320
1321
1321
// / Lowers llvm.matrix.column.major.load.
1322
1322
// /
1323
1323
// / The intrinsic loads a matrix from memory using a stride between columns.
1324
- MatrixTy LowerColumnMajorLoad (CallInst *Inst) {
1324
+ MatrixTy LowerColumnMajorLoad (CallInst *Inst, IRBuilder<> &Builder ) {
1325
1325
assert (MatrixLayout == MatrixLayoutTy::ColumnMajor &&
1326
1326
" Intrinsic only supports column-major layout!" );
1327
1327
Value *Ptr = Inst->getArgOperand (0 );
1328
1328
Value *Stride = Inst->getArgOperand (1 );
1329
1329
return LowerLoad (Inst, Ptr, Inst->getParamAlign (0 ), Stride,
1330
1330
cast<ConstantInt>(Inst->getArgOperand (2 ))->isOne (),
1331
- {Inst->getArgOperand (3 ), Inst->getArgOperand (4 )});
1331
+ {Inst->getArgOperand (3 ), Inst->getArgOperand (4 )}, Builder );
1332
1332
}
1333
1333
1334
1334
// / Stores a sub-matrix \p StoreVal into the \p R x \p C matrix starting at \p
@@ -1373,8 +1373,7 @@ class LowerMatrixIntrinsics {
1373
1373
// / Lower a store instruction with shape information.
1374
1374
MatrixTy LowerStore (Instruction *Inst, Value *Matrix, Value *Ptr,
1375
1375
MaybeAlign A, Value *Stride, bool IsVolatile,
1376
- ShapeInfo Shape) {
1377
- IRBuilder<> Builder (Inst);
1376
+ ShapeInfo Shape, IRBuilder<> &Builder) {
1378
1377
auto StoreVal = getMatrix (Matrix, Shape, Builder);
1379
1378
return storeMatrix (Matrix->getType (), StoreVal, Ptr, A, Stride, IsVolatile,
1380
1379
Builder);
@@ -1383,15 +1382,16 @@ class LowerMatrixIntrinsics {
1383
1382
// / Lowers llvm.matrix.column.major.store.
1384
1383
// /
1385
1384
// / The intrinsic store a matrix back memory using a stride between columns.
1386
- MatrixTy LowerColumnMajorStore (CallInst *Inst) {
1385
+ MatrixTy LowerColumnMajorStore (CallInst *Inst, IRBuilder<> &Builder ) {
1387
1386
assert (MatrixLayout == MatrixLayoutTy::ColumnMajor &&
1388
1387
" Intrinsic only supports column-major layout!" );
1389
1388
Value *Matrix = Inst->getArgOperand (0 );
1390
1389
Value *Ptr = Inst->getArgOperand (1 );
1391
1390
Value *Stride = Inst->getArgOperand (2 );
1392
1391
return LowerStore (Inst, Matrix, Ptr, Inst->getParamAlign (1 ), Stride,
1393
1392
cast<ConstantInt>(Inst->getArgOperand (3 ))->isOne (),
1394
- {Inst->getArgOperand (4 ), Inst->getArgOperand (5 )});
1393
+ {Inst->getArgOperand (4 ), Inst->getArgOperand (5 )},
1394
+ Builder);
1395
1395
}
1396
1396
1397
1397
// Set elements I..I+NumElts-1 to Block
@@ -2166,8 +2166,7 @@ class LowerMatrixIntrinsics {
2166
2166
}
2167
2167
2168
2168
// / Lowers llvm.matrix.multiply.
2169
- MatrixTy LowerMultiply (CallInst *MatMul) {
2170
- IRBuilder<> Builder (MatMul);
2169
+ MatrixTy LowerMultiply (CallInst *MatMul, IRBuilder<> &Builder) {
2171
2170
auto *EltType = cast<FixedVectorType>(MatMul->getType ())->getElementType ();
2172
2171
ShapeInfo LShape (MatMul->getArgOperand (2 ), MatMul->getArgOperand (3 ));
2173
2172
ShapeInfo RShape (MatMul->getArgOperand (3 ), MatMul->getArgOperand (4 ));
@@ -2192,9 +2191,8 @@ class LowerMatrixIntrinsics {
2192
2191
}
2193
2192
2194
2193
// / Lowers llvm.matrix.transpose.
2195
- MatrixTy LowerTranspose (CallInst *Inst) {
2194
+ MatrixTy LowerTranspose (CallInst *Inst, IRBuilder<> &Builder ) {
2196
2195
MatrixTy Result;
2197
- IRBuilder<> Builder (Inst);
2198
2196
Value *InputVal = Inst->getArgOperand (0 );
2199
2197
FixedVectorType *VectorTy = cast<FixedVectorType>(InputVal->getType ());
2200
2198
ShapeInfo ArgShape (Inst->getArgOperand (1 ), Inst->getArgOperand (2 ));
@@ -2230,13 +2228,15 @@ class LowerMatrixIntrinsics {
2230
2228
MatrixTy VisitLoad (LoadInst *Inst, const ShapeInfo &SI, Value *Ptr,
2231
2229
IRBuilder<> &Builder) {
2232
2230
return LowerLoad (Inst, Ptr, Inst->getAlign (),
2233
- Builder.getInt64 (SI.getStride ()), Inst->isVolatile (), SI);
2231
+ Builder.getInt64 (SI.getStride ()), Inst->isVolatile (), SI,
2232
+ Builder);
2234
2233
}
2235
2234
2236
2235
MatrixTy VisitStore (StoreInst *Inst, const ShapeInfo &SI, Value *StoredVal,
2237
2236
Value *Ptr, IRBuilder<> &Builder) {
2238
2237
return LowerStore (Inst, StoredVal, Ptr, Inst->getAlign (),
2239
- Builder.getInt64 (SI.getStride ()), Inst->isVolatile (), SI);
2238
+ Builder.getInt64 (SI.getStride ()), Inst->isVolatile (), SI,
2239
+ Builder);
2240
2240
}
2241
2241
2242
2242
// / Lower binary operators.
0 commit comments