mirror of
https://github.com/intel/llvm.git
synced 2026-02-03 02:26:27 +08:00
Revert "[mlir][llvm] Fix elem type passing into getelementptr (#68136)"
This reverts commit fe283a1ff7.
Bot is broken.
This commit is contained in:
@@ -303,13 +303,8 @@ def LLVM_GEPOp : LLVM_Op<"getelementptr", [Pure,
|
||||
indices.push_back(
|
||||
builder.getInt32(valueOrAttr.get<IntegerAttr>().getInt()));
|
||||
}
|
||||
|
||||
Type elemTypeFromAttr = op.getSourceElementType();
|
||||
auto ptrType = ::llvm::cast<LLVMPointerType>(op.getType());
|
||||
Type elemTypeFromPtrType = ptrType.getElementType();
|
||||
|
||||
llvm::Type *elementType = moduleTranslation.convertType(
|
||||
elemTypeFromAttr ? elemTypeFromAttr : elemTypeFromPtrType);
|
||||
Type baseElementType = op.getSourceElementType();
|
||||
llvm::Type *elementType = moduleTranslation.convertType(baseElementType);
|
||||
$res = builder.CreateGEP(elementType, $base, indices, "", $inbounds);
|
||||
}];
|
||||
let assemblyFormat = [{
|
||||
|
||||
@@ -287,17 +287,14 @@ ParseResult AllocaOp::parse(OpAsmParser &parser, OperationState &result) {
|
||||
}
|
||||
|
||||
/// Checks that the elemental type is present in either the pointer type or
|
||||
/// the attribute, but not in none or both.
|
||||
/// the attribute, but not both.
|
||||
static LogicalResult verifyOpaquePtr(Operation *op, LLVMPointerType ptrType,
|
||||
std::optional<Type> ptrElementType) {
|
||||
bool typePresentInPointerType = !ptrType.isOpaque();
|
||||
bool typePresentInAttribute = ptrElementType.has_value();
|
||||
|
||||
if (!typePresentInPointerType && !typePresentInAttribute) {
|
||||
if (ptrType.isOpaque() && !ptrElementType.has_value()) {
|
||||
return op->emitOpError() << "expected '" << kElemTypeAttrName
|
||||
<< "' attribute if opaque pointer type is used";
|
||||
}
|
||||
if (typePresentInPointerType && typePresentInAttribute) {
|
||||
if (!ptrType.isOpaque() && ptrElementType.has_value()) {
|
||||
return op->emitOpError()
|
||||
<< "unexpected '" << kElemTypeAttrName
|
||||
<< "' attribute when non-opaque pointer type is used";
|
||||
|
||||
@@ -42,15 +42,6 @@ llvm.func @opaque_ptr_gep_struct(%arg0: !llvm.ptr, %arg1: i32) -> !llvm.ptr {
|
||||
llvm.return %0 : !llvm.ptr
|
||||
}
|
||||
|
||||
// CHECK-LABEL: @opaque_ptr_elem_type
|
||||
llvm.func @opaque_ptr_elem_type(%0: !llvm.ptr) -> !llvm.ptr {
|
||||
// CHECK: getelementptr ptr, ptr
|
||||
%1 = llvm.getelementptr %0[0] { elem_type = !llvm.ptr } : (!llvm.ptr) -> !llvm.ptr
|
||||
// CHECK: getelementptr ptr, ptr
|
||||
%2 = llvm.getelementptr %0[0] : (!llvm.ptr) -> !llvm.ptr<ptr>
|
||||
llvm.return %1 : !llvm.ptr
|
||||
}
|
||||
|
||||
// CHECK-LABEL: @opaque_ptr_matrix_load_store
|
||||
llvm.func @opaque_ptr_matrix_load_store(%ptr: !llvm.ptr, %stride: i64) -> vector<48 x f32> {
|
||||
// CHECK: call <48 x float> @llvm.matrix.column.major.load.v48f32.i64
|
||||
|
||||
Reference in New Issue
Block a user