@@ -3223,7 +3223,6 @@ convertOmpAtomicUpdate(omp::AtomicUpdateOp &opInst,
32233223
32243224 llvm::AtomicOrdering atomicOrdering =
32253225 convertAtomicOrdering (opInst.getMemoryOrder ());
3226-
32273226 // Generate update code.
32283227 auto updateFn =
32293228 [&opInst, &moduleTranslation](
@@ -3242,21 +3241,27 @@ convertOmpAtomicUpdate(omp::AtomicUpdateOp &opInst,
32423241 return moduleTranslation.lookupValue (yieldop.getResults ()[0 ]);
32433242 };
32443243
3245- mlir::omp::AtomicControlAttr atomicControlAttr =
3246- opInst.getAtomicControlAttr ();
3247- bool isAmdgpuIgnoreDenormalMode =
3248- atomicControlAttr.getAmdgpuIgnoreDenormalMode ();
3249- bool isAmdgpuNoFineGrainedMemory =
3250- !atomicControlAttr.getAmdgpuFineGrainedMemory ();
3251- bool isAmdgpuNoRemoteMemory = !atomicControlAttr.getAmdgpuRemoteMemory ();
3244+ bool isIgnoreDenormalMode = false ;
3245+ bool isNoFineGrainedMemory = false ;
3246+ bool isNoRemoteMemory = false ;
3247+ if (opInst->hasAttr (opInst.getAtomicControlAttrName ())) {
3248+ mlir::omp::AtomicControlAttr atomicControlAttr =
3249+ opInst.getAtomicControlAttr ();
3250+ isIgnoreDenormalMode =
3251+ atomicControlAttr.getIgnoreDenormalMode ();
3252+ isNoFineGrainedMemory =
3253+ !atomicControlAttr.getFineGrainedMemory ();
3254+ isNoRemoteMemory = !atomicControlAttr.getRemoteMemory ();
3255+
3256+ }
32523257 // Handle ambiguous alloca, if any.
32533258 auto allocaIP = findAllocaInsertPoint (builder, moduleTranslation);
32543259 llvm::OpenMPIRBuilder::LocationDescription ompLoc (builder);
32553260 llvm::OpenMPIRBuilder::InsertPointOrErrorTy afterIP =
32563261 ompBuilder->createAtomicUpdate (
32573262 ompLoc, allocaIP, llvmAtomicX, llvmExpr, atomicOrdering, binop,
3258- updateFn, isXBinopExpr, isAmdgpuIgnoreDenormalMode ,
3259- isAmdgpuNoFineGrainedMemory, isAmdgpuNoRemoteMemory );
3263+ updateFn, isXBinopExpr, isIgnoreDenormalMode ,
3264+ isNoFineGrainedMemory, isNoRemoteMemory );
32603265
32613266 if (failed (handleError (afterIP, *opInst)))
32623267 return failure ();
@@ -3346,17 +3351,17 @@ convertOmpAtomicCapture(omp::AtomicCaptureOp atomicCaptureOp,
33463351 return moduleTranslation.lookupValue (yieldop.getResults ()[0 ]);
33473352 };
33483353
3349- bool isAmdgpuIgnoreDenormalMode = false ;
3350- bool isAmdgpuNoFineGrainedMemory = true ;
3351- bool isAmdgpuNoRemoteMemory = true ;
3354+ bool isIgnoreDenormalMode = false ;
3355+ bool isNoFineGrainedMemory = true ;
3356+ bool isNoRemoteMemory = true ;
33523357 if (atomicUpdateOp) {
33533358 mlir::omp::AtomicControlAttr atomicControlAttr =
33543359 atomicUpdateOp.getAtomicControlAttr ();
3355- isAmdgpuIgnoreDenormalMode =
3356- atomicControlAttr.getAmdgpuIgnoreDenormalMode ();
3357- isAmdgpuNoFineGrainedMemory =
3358- !atomicControlAttr.getAmdgpuFineGrainedMemory ();
3359- isAmdgpuNoRemoteMemory = !atomicControlAttr.getAmdgpuRemoteMemory ();
3360+ isIgnoreDenormalMode =
3361+ atomicControlAttr.getIgnoreDenormalMode ();
3362+ isNoFineGrainedMemory =
3363+ !atomicControlAttr.getFineGrainedMemory ();
3364+ isNoRemoteMemory = !atomicControlAttr.getRemoteMemory ();
33603365 }
33613366 // Handle ambiguous alloca, if any.
33623367 auto allocaIP = findAllocaInsertPoint (builder, moduleTranslation);
@@ -3365,8 +3370,8 @@ convertOmpAtomicCapture(omp::AtomicCaptureOp atomicCaptureOp,
33653370 ompBuilder->createAtomicCapture (
33663371 ompLoc, allocaIP, llvmAtomicX, llvmAtomicV, llvmExpr, atomicOrdering,
33673372 binop, updateFn, atomicUpdateOp, isPostfixUpdate, isXBinopExpr,
3368- isAmdgpuIgnoreDenormalMode, isAmdgpuNoFineGrainedMemory ,
3369- isAmdgpuNoRemoteMemory );
3373+ isIgnoreDenormalMode, isNoFineGrainedMemory ,
3374+ isNoRemoteMemory );
33703375
33713376 if (failed (handleError (afterIP, *atomicCaptureOp)))
33723377 return failure ();
0 commit comments