This is an archive of the discontinued LLVM Phabricator instance.

[MemRefToLLVM] Add a method in MemRefDescriptor to get the buffer addr
ClosedPublic

Authored by qcolombet on Apr 21 2023, 11:30 AM.

Details

Summary

This patch pushes the computation of the start address of a memref in one
place (a method in MemRefDescriptor.)

This allows all the (indirect) users of this method to produce the start
address in the same way.

Thanks to this change, we expose more CSEs opportunities and thanks to
that, the backend is able to properly find the llvm.assume expression
related to the base address as demonstrated in the added test.

Diff Detail

Event Timeline

qcolombet created this revision.Apr 21 2023, 11:30 AM
Herald added a project: Restricted Project. · View Herald Transcript
qcolombet requested review of this revision.Apr 21 2023, 11:30 AM
mravishankar accepted this revision.Apr 21 2023, 1:37 PM

This is good too! Thanks!

This revision is now accepted and ready to land.Apr 21 2023, 1:37 PM
mlir/lib/Conversion/LLVMCommon/MemRefBuilder.cpp
211

nit: can we turn this into an early exit?

if (offsetCst == 0)
  return ptr;

...
qcolombet marked an inline comment as done.May 16 2023, 1:59 AM
qcolombet added inline comments.
mlir/lib/Conversion/LLVMCommon/MemRefBuilder.cpp
211