It appears llc gives preference to the default target datalayout whereas opt gives preference to the module datalayout. Is there a reason they behave differently? From llc.cpp: // Add the target data from the target machine, if it exists, or the module. if (const TargetData *TD = Target.getTargetData()) PM.add(new TargetData(*TD)); else PM.add(new TargetData(&mod)); From opt.cpp: // Add an appropriate TargetData instance for this module. TargetData *TD = 0; const std::string &ModuleDataLayout = M.get()->getDataLayout(); if (!ModuleDataLayout.empty()) TD = new TargetData(ModuleDataLayout); else if (!DefaultDataLayout.empty()) TD = new TargetData(DefaultDataLayout); if (TD) Passes.add(TD);
Duncan Sands
2011-Oct-04 07:18 UTC
[LLVMdev] opt and llc use datalayout differently - bug?
Hi JP,> It appears llc gives preference to the default target datalayout whereas > opt gives preference to the module datalayout.llc completely ignores the target datalayout because it already knows how the target lays out data. Target datalayout exists entirely for the benefit of opt: it allows opt to use target specific information without having to be linked with the code generators. Ciao, Duncan.
Possibly Parallel Threads
- [LLVMdev] Module->getDataLayout returns std::string instead of DataLayout
- [LLVMdev] getAnalysis<DataLayout>() Causing Compilation Error
- [LLVMdev] Kaleidoscope tutorial failed at Chapter 4...
- [LLVMdev] addPassesToEmit(Whole)File changes?
- [LLVMdev] Something about the andersens pass