mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-20 06:18:55 +00:00
[MLIR] Avoid some pointer element type accesses
Determine the element type from the MLIR LLVMPointerType, rather than the LLVM PointerType.
This commit is contained in:
parent
8a72391f60
commit
ea043ea183
@ -280,9 +280,10 @@ convertOperationImpl(Operation &opInst, llvm::IRBuilderBase &builder,
|
||||
if (auto attr = op.getAttrOfType<FlatSymbolRefAttr>("callee"))
|
||||
return builder.CreateCall(
|
||||
moduleTranslation.lookupFunction(attr.getValue()), operandsRef);
|
||||
auto *calleeType = operandsRef.front()->getType();
|
||||
auto *calleeFunctionType =
|
||||
cast<llvm::FunctionType>(calleeType->getPointerElementType());
|
||||
auto calleeType =
|
||||
op.getOperands().front().getType().cast<LLVMPointerType>();
|
||||
auto *calleeFunctionType = cast<llvm::FunctionType>(
|
||||
moduleTranslation.convertType(calleeType.getElementType()));
|
||||
return builder.CreateCall(calleeFunctionType, operandsRef.front(),
|
||||
operandsRef.drop_front());
|
||||
};
|
||||
@ -367,9 +368,10 @@ convertOperationImpl(Operation &opInst, llvm::IRBuilderBase &builder,
|
||||
moduleTranslation.lookupBlock(invOp.getSuccessor(0)),
|
||||
moduleTranslation.lookupBlock(invOp.getSuccessor(1)), operandsRef);
|
||||
} else {
|
||||
auto *calleeType = operandsRef.front()->getType();
|
||||
auto *calleeFunctionType =
|
||||
cast<llvm::FunctionType>(calleeType->getPointerElementType());
|
||||
auto calleeType =
|
||||
invOp.getCalleeOperands().front().getType().cast<LLVMPointerType>();
|
||||
auto *calleeFunctionType = cast<llvm::FunctionType>(
|
||||
moduleTranslation.convertType(calleeType.getElementType()));
|
||||
result = builder.CreateInvoke(
|
||||
calleeFunctionType, operandsRef.front(),
|
||||
moduleTranslation.lookupBlock(invOp.getSuccessor(0)),
|
||||
|
@ -874,11 +874,14 @@ convertOmpWsLoop(Operation &opInst, llvm::IRBuilderBase &builder,
|
||||
llvm::OpenMPIRBuilder::AtomicReductionGenTy atomicGen = nullptr;
|
||||
if (owningAtomicReductionGens[i])
|
||||
atomicGen = owningAtomicReductionGens[i];
|
||||
auto reductionType =
|
||||
loop.reduction_vars()[i].getType().cast<LLVM::LLVMPointerType>();
|
||||
llvm::Value *variable =
|
||||
moduleTranslation.lookupValue(loop.reduction_vars()[i]);
|
||||
reductionInfos.push_back({variable->getType()->getPointerElementType(),
|
||||
variable, privateReductionVariables[i],
|
||||
owningReductionGens[i], atomicGen});
|
||||
reductionInfos.push_back(
|
||||
{moduleTranslation.convertType(reductionType.getElementType()),
|
||||
variable, privateReductionVariables[i], owningReductionGens[i],
|
||||
atomicGen});
|
||||
}
|
||||
|
||||
// The call to createReductions below expects the block to have a
|
||||
|
Loading…
Reference in New Issue
Block a user