After one shot bufferization, redundant memref allocation and memref.copy is introduced.Is there any pass which can eliminate this? (original) (raw)
Can the memref.copy and allocation in following image be simplified and eliminated by any pass? which pass?
Is it really redundant? Some other ops in your loop nest are reading from %arg3
, so you have to be careful not to overwrite data that is still needed. That’s the kind of analysis that the bufferization pass performs and it’s quite involved.
You can try running -one-shot-bufferize="test-analysis-only print-conflicts"
to get additional debug output that can help you understand why this copy was inserted.
Also make sure to enable bufferize-function-boundaries
. Otherwise, all function bbargs are treated as read-only.
thanks very much. I make a mistake.