Creating a JIT-ExecutionEngine overrides the CodeModel set by TargetMachine
| Bugzilla Link | 5773 |
| Resolution | FIXED |
| Resolved on | Dec 21, 2009 16:26 |
| Version | trunk |
| OS | Linux |
| Reporter | LLVM Bugzilla Contributor |
| CC | @asl,@echristo,@rnk |
Extended Description
The constructor of X86TargetMachine sets the CodeModel from Default to Small on x86_32 targets.
When creating a new ExecutionEngine via ExecutionEngine::create((ModuleProvider *MP, bool ForceInterpreter=false, ...) this gets reset to Default by ExecutionEngine::createJit. The value is taken from EngineBuilder::CMModel, which gets initialized to Default. On this code path there is no way to influence this value.
X86FastISel only implements the Small code model and tests for cm == CodeModel::Small, thus fails even on 32bit.
Going to call it fixed then.
Appears fixed to me. With this patch, the small code model is correctly selected in unladen swallow on x86_32.
Still need to test x86_64.
Did you have a testcase so I can avoid breaking this in the future btw?
Mostly done. I'll test and commit in the next day.
Yeah, this is me. I'll get this in the next day or two.
It seems like this is a regression introduced in r89151 by echristo. Only X68 and Mips seem to care about the code model, and they both change it from default to small in their constructors. I'm guessing that either TargetMachine::setCodeModel needs to emulate this behavior by turning default to small, or the code model needs to get wired through the target machine construction (ew) so that the constructor can properly turn default to small.
Changing setCodeModel sounds like the right approach to me, but right now it's a static method that actually changes a global command line flag and not some TargetMachine setting. Nerg.