[mlir] Remove static constructors from LLVMType

LLVMType contains numerous static constructors that were initially introduced
for API compatibility with LLVM. Most of these merely forward to arguments to
`SpecificType::get` (MLIR defines classes for all types, unlike LLVM IR), while
some introduce subtle semantics differences due to different modeling of MLIR
types (e.g., structs are not auto-renamed in case of conflicts). Furthermore,
these constructors don't match MLIR idioms and actively prevent us from making
the LLVM dialect type system more open. Remove them and use `SpecificType::get`
instead.

Depends On D93680

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D93681
This commit is contained in:
Alex Zinenko
2020-12-22 11:22:56 +01:00
parent eb9483b210
commit 7ed9cfc7b1
23 changed files with 267 additions and 415 deletions

View File

@@ -769,13 +769,12 @@ LogicalResult ModuleTranslation::convertOperation(Operation &opInst,
LLVM::LLVMType resultType;
if (inlineAsmOp.getNumResults() == 0) {
resultType = LLVM::LLVMType::getVoidTy(mlirModule->getContext());
resultType = LLVM::LLVMVoidType::get(mlirModule->getContext());
} else {
assert(inlineAsmOp.getNumResults() == 1);
resultType = inlineAsmOp.getResultTypes()[0].cast<LLVM::LLVMType>();
}
auto ft = LLVM::LLVMType::getFunctionTy(resultType, operandTypes,
/*isVarArg=*/false);
auto ft = LLVM::LLVMFunctionType::get(resultType, operandTypes);
llvm::InlineAsm *inlineAsmInst =
inlineAsmOp.asm_dialect().hasValue()
? llvm::InlineAsm::get(