<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi all,<div class=""><br class=""></div><div class="">The Language Reference says:</div><div class=""><br class=""></div><div class="">"The function of the data layout string may not be what you expect. Notably, this is not a specification from the frontend of what alignment the code generator should use.</div><div class="section" id="data-layout"><div style="margin: 0.8em 0px 0.5em;" class="">Instead, if specified, the target data layout is required to match what the ultimate <em class="">code generator</em> expects. This string is used by the mid-level optimizers to improve code, and this only works if it matches what the ultimate code generator uses. If you would like to generate IR that does not embed this target-specific detail into the IR, then you don’t have to specify the string. This will disable some optimizations that require precise layout information, but this also prevents those optimizations from introducing target specificity into the IR.”</div><div style="margin: 0.8em 0px 0.5em;" class="">I understand from this that the DataLayout present in the Module *must* match the DataLayout that the Target will use.</div><div style="margin: 0.8em 0px 0.5em;" class="">There is no runtime check to enforce this at that time. </div><div style="margin: 0.8em 0px 0.5em;" class="">My impression is that I can set the DataLayout on the Module to be big-endian and run the optimizer and the X86 backend. </div><div style="margin: 0.8em 0px 0.5em;" class="">The IR-level passes will use the DataLayout supplied with the Module and the backend code will silently use the TargetMachine one.</div><div style="margin: 0.8em 0px 0.5em;" class="">Should we enforce that the DataLayout attached to the Module matches the one expected by the Target?</div><div style="margin: 0.8em 0px 0.5em;" class="">Thanks,</div><div style="margin: 0.8em 0px 0.5em;" class="">Mehdi</div></div><div class="section" id="target-triple"><span id="langref-triple" style="font-family: 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif; font-size: 14px; line-height: 21px;" class=""></span></div></body></html>