================ @@ -76,6 +76,69 @@ struct LLVMPointerPointerLikeModel LLVM::LLVMPointerType> { Type getElementType(Type pointer) const { return Type(); } }; + +/// Helper function for any of the times we need to modify an ArrayAttr based on +/// a device type list. Returns a new ArrayAttr with all of the +/// existingDeviceTypes, plus the effective new ones(or an added none if hte new +/// list is empty). +mlir::ArrayAttr addDeviceTypeAffectedOperandHelper( + MLIRContext *context, mlir::ArrayAttr existingDeviceTypes, + llvm::ArrayRef<acc::DeviceType> newDeviceTypes) { + llvm::SmallVector<mlir::Attribute> deviceTypes; + if (existingDeviceTypes) + llvm::copy(existingDeviceTypes, std::back_inserter(deviceTypes)); + + if (newDeviceTypes.empty()) + deviceTypes.push_back( + acc::DeviceTypeAttr::get(context, acc::DeviceType::None)); + + for (DeviceType DT : newDeviceTypes) + deviceTypes.push_back(acc::DeviceTypeAttr::get(context, DT)); + + return mlir::ArrayAttr::get(context, deviceTypes); +} + +/// Helper function for any of the times we need to add operands that are +/// affected by a device type list. Returns a new ArrayAttr with all of the +/// existingDeviceTypes, plus the effective new ones(or an added none, if the +/// new list is empty). Additionally, adds the arguments to the argCollection +/// the correct number of times. This will also update a 'segments' array, even +/// if it won't be used. ---------------- andykaylor wrote:
It seems that your change drops the lengthy comment explaining segments. Do you think that's worth preserving? https://github.com/llvm/llvm-project/pull/137396 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits