forked from OSchip/llvm-project
[MatrixBuilder] Require explicit element type in CreateColumnMajorLoad()
This makes the method compatible with opaque pointers.
This commit is contained in:
parent
807e2f12fa
commit
c45a99f36b
|
@ -3250,8 +3250,9 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID,
|
|||
EmitNonNullArgCheck(RValue::get(Src.getPointer()), E->getArg(0)->getType(),
|
||||
E->getArg(0)->getExprLoc(), FD, 0);
|
||||
Value *Result = MB.CreateColumnMajorLoad(
|
||||
Src.getPointer(), Align(Src.getAlignment().getQuantity()), Stride,
|
||||
IsVolatile, ResultTy->getNumRows(), ResultTy->getNumColumns(),
|
||||
Src.getElementType(), Src.getPointer(),
|
||||
Align(Src.getAlignment().getQuantity()), Stride, IsVolatile,
|
||||
ResultTy->getNumRows(), ResultTy->getNumColumns(),
|
||||
"matrix");
|
||||
return RValue::get(Result);
|
||||
}
|
||||
|
|
|
@ -58,18 +58,14 @@ public:
|
|||
MatrixBuilder(IRBuilderBase &Builder) : B(Builder) {}
|
||||
|
||||
/// Create a column major, strided matrix load.
|
||||
/// \p EltTy - Matrix element type
|
||||
/// \p DataPtr - Start address of the matrix read
|
||||
/// \p Rows - Number of rows in matrix (must be a constant)
|
||||
/// \p Columns - Number of columns in matrix (must be a constant)
|
||||
/// \p Stride - Space between columns
|
||||
CallInst *CreateColumnMajorLoad(Value *DataPtr, Align Alignment,
|
||||
CallInst *CreateColumnMajorLoad(Type *EltTy, Value *DataPtr, Align Alignment,
|
||||
Value *Stride, bool IsVolatile, unsigned Rows,
|
||||
unsigned Columns, const Twine &Name = "") {
|
||||
|
||||
// Deal with the pointer
|
||||
PointerType *PtrTy = cast<PointerType>(DataPtr->getType());
|
||||
Type *EltTy = PtrTy->getPointerElementType();
|
||||
|
||||
auto *RetType = FixedVectorType::get(EltTy, Rows * Columns);
|
||||
|
||||
Value *Ops[] = {DataPtr, Stride, B.getInt1(IsVolatile), B.getInt32(Rows),
|
||||
|
|
|
@ -1614,10 +1614,10 @@ def LLVM_MatrixColumnMajorLoadOp : LLVM_Op<"intr.matrix.column.major.load"> {
|
|||
llvm::MatrixBuilder mb(builder);
|
||||
const llvm::DataLayout &dl =
|
||||
builder.GetInsertBlock()->getModule()->getDataLayout();
|
||||
llvm::Align align = dl.getABITypeAlign(
|
||||
$data->getType()->getPointerElementType());
|
||||
llvm::Type *ElemTy = $data->getType()->getPointerElementType();
|
||||
llvm::Align align = dl.getABITypeAlign(ElemTy);
|
||||
$res = mb.CreateColumnMajorLoad(
|
||||
$data, align, $stride, $isVolatile, $rows,
|
||||
ElemTy, $data, align, $stride, $isVolatile, $rows,
|
||||
$columns);
|
||||
}];
|
||||
let assemblyFormat = "$data `,` `<` `stride` `=` $stride `>` attr-dict"
|
||||
|
|
Loading…
Reference in New Issue