================ @@ -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 ---------------- andykaylor wrote:
```suggestion /// existingDeviceTypes, plus the effective new ones (or an added none, if the ``` 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