Improve handling of datalayout for generic targets.
Flag 32-bit vector types as only requiring 32-bit alignment (preemptive bug fix for 32xi1 vectors). Force module datalayouts to be the same before linking them to silence an LLVM warning. Finishes issue #309.
This commit is contained in:
@@ -619,6 +619,14 @@ AddBitcodeToModule(const unsigned char *bitcode, int length,
|
||||
mTriple.getVendor() == bcTriple.getVendor());
|
||||
bcModule->setTargetTriple(mTriple.str());
|
||||
|
||||
// This is also suboptimal; LLVM issues a warning about linking
|
||||
// modules with different datalayouts, due to things like
|
||||
// bulitins-c.c having the regular IA layout, but the generic
|
||||
// targets having a layout with 16-bit alignment for 16xi1 vectors.
|
||||
// As long as builtins-c.c doesn't have any 16xi1 vector types
|
||||
// (which it shouldn't!), then this override is safe.
|
||||
bcModule->setDataLayout(module->getDataLayout());
|
||||
|
||||
std::string(linkError);
|
||||
if (llvm::Linker::LinkModules(module, bcModule,
|
||||
llvm::Linker::DestroySource,
|
||||
|
||||
Reference in New Issue
Block a user