@@ -738,19 +738,17 @@ genDataOperandOperations(const Fortran::parser::AccObjectList &objectList,
738738 implicit, dataClause, baseAddr.getType (), async, asyncDeviceTypes,
739739 asyncOnlyDeviceTypes, /* unwrapBoxAddr=*/ true , info.isPresent );
740740 dataOperands.push_back (op.getAccVar ());
741- // If the input value has a descriptor, we need to create a use device op
742- // for the descriptor as well as the base address .
741+ // For UseDeviceOp, if operand is one of a pair resulting from a
742+ // declare operation, create a UseDeviceOp for the other operand as well .
743743 if constexpr (std::is_same_v<Op, mlir::acc::UseDeviceOp>) {
744- LLVM_DEBUG (llvm::dbgs () << __func__ << " found usedeviceop \n " ; info.dump (llvm::dbgs ()));
745- LLVM_DEBUG (llvm::dbgs () << __func__ << " had previously created and added usedeviceop \n " ; op.dump ());
746744 if (mlir::isa<hlfir::DeclareOp>(baseAddr.getDefiningOp ())) {
747745 Op op = createDataEntryOp<Op>(
748- builder, operandLocation, baseAddr.getDefiningOp ()->getResult (1 ), asFortran, bounds, structured,
749- implicit, dataClause, baseAddr.getDefiningOp ()->getResult (1 ).getType (), async, asyncDeviceTypes,
750- asyncOnlyDeviceTypes, /* unwrapBoxAddr=*/ true , info.isPresent );
751- LLVM_DEBUG (llvm::dbgs () << __func__ << " created usedeviceop \n " ; op.dump ());
746+ builder, operandLocation, baseAddr.getDefiningOp ()->getResult (1 ),
747+ asFortran, bounds, structured, implicit, dataClause,
748+ baseAddr.getDefiningOp ()->getResult (1 ).getType (), async,
749+ asyncDeviceTypes, asyncOnlyDeviceTypes, /* unwrapBoxAddr=*/ true ,
750+ info.isPresent );
752751 dataOperands.push_back (op.getAccVar ());
753- LLVM_DEBUG (llvm::dbgs () << __func__ << " added usedeviceop on descriptor\n " ; info.dump (llvm::dbgs ()));
754752 }
755753 }
756754 }
0 commit comments