FuncToLLVM uses the data layout string attribute in 3 different ways:
- LowerToLLVMOptions options(&getContext(), getAnalysis<DataLayoutAnalysis>().getAtOrAbove(m));
- options.dataLayout = llvm::DataLayout(this->dataLayout);
- m->setAttr(..., this->dataLayout));
This revision shows that 2. is basically unused:
- the patterns populated from FuncToLLVM.cpp do not use options.dataLayout
- the only patterns using options.dataLayout are in ConvertVectorToLLVM but the only way they are called is with the default data layout string ""
Given the inter-pass consistency issues raised in this post,
this is another latent consistency footgun that we can nip in the bud.
In the future, we need to standardize on MLIR DataLayoutAnalysis but the cleanup of unused LowerToLLVMOptions::dataLayout / its constant propagation to
its users, reduces chances for errors.
- is retired in a separate PR https://reviews.llvm.org/D157604
In the future, we should all converge on 1. but this is beyond the scope of this revision.