Description
Example of such an assertion:
Assertion 'TM.isCompatibleDataLayout(getDataLayout()) && "Can't create a MachineFunction using a Module with a " "Target-incompatible DataLayout attached\n"' failed.
It appears that since LLVM 3.7, DataLayout
is checked for target compatibility, and as joker-eph
on LLVM's IRC channel on OFTC explains:
technically a Target can implement a "compatibility check" if it is willing to relax the constrain that the DL matches, but we haven't implemented anything like that that I know of. So the backend check if the Module data layout is the same as what the target wants.
The relevant method is bool TargetMachine::isCompatibleDataLayout(const DataLayout &Candidate)
.
joker-eph
suggests warning and overriding an incompatible data layout with the target default.
However, I don't think we can do anything but error because we would've already used the (incompatible) data layout string for determining type layouts.
We can at least provide the target default data layout string for the user in that situation.
cc @alexcrichton