[Mlir-commits] [llvm] [mlir] [llvm][OpenMP] Add implicit cast to omp.atomic.read (PR #114659)
Tom Eccles
llvmlistbot at llvm.org
Mon Nov 4 02:48:05 PST 2024
================
@@ -265,6 +265,32 @@ computeOpenMPScheduleType(ScheduleKind ClauseKind, bool HasChunks,
return Result;
}
+/// Emit an implicit cast to convert \p XRead to type of variable \p V
+static llvm::Value *emitImplicitCast(IRBuilder<> &Builder, llvm::Value *XRead,
+ llvm::Value *V) {
+ llvm::Type *XReadType = XRead->getType();
+ llvm::Type *VType = V->getType();
+ if (llvm::AllocaInst *vAlloca = dyn_cast<llvm::AllocaInst>(V))
+ VType = vAlloca->getAllocatedType();
+
+ if (XReadType->isStructTy() && VType->isStructTy())
+ // No need to extract or convert. A direct
+ // `store` will suffice.
+ return XRead;
+
+ if (XRead->getType()->isStructTy())
----------------
tblah wrote:
Why not use `XReadType` here?
https://github.com/llvm/llvm-project/pull/114659
More information about the Mlir-commits
mailing list