Add conversion from memref.alloc to gpu.alloc

I’m trying to write a pass to convert memref.alloc to gpu.alloc, but it seems like mlir::gpu::AllocOp cannot be converted to an mlir::Value?
More specifically, when I try to replace memref.alloc with gpu.alloc using ConversionPatternRewriter::replaceOp, it complains saying

no known conversion from 'mlir::gpu::AllocOp' to 'mlir::Value'

Am I missing something?

Alternatively, is there an already existing lowering path to gpu.alloc? I looked through the repository and it doesn’t seem like such a path exists.

You probably need to just call getResult() on the allocOp when you pass it to replaceOp

Perfect! Thank you, Mehdi!