[llvm] [mlir] [llvm][OpenMP] Add implicit cast to omp.atomic.read (PR #114659)

Tom Eccles via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 4 02:48:04 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();
----------------
tblah wrote:

Why would AllocaInst::getAllocatedType be different to the value's type?

https://github.com/llvm/llvm-project/pull/114659


More information about the llvm-commits mailing list