[llvm-commits] [llvm] r160610 - /llvm/trunk/lib/ExecutionEngine/TargetSelect.cpp

Andy,

Yes, it was wrong, as long as RemoteTarget is available for the target.

If you would revert it, please consider then;

  - non-MCJIT stuff
  - Running different environment on the JIT
    e.g.) --build=--host=i686-linux --target=x86_64-linux
  - Host-incapable target on the JIT
    e.g.) --build=--host=x86_64-linux ---target=i686-mingw32

If JIT is unavailable for the default target, tests in
test/ExecutionEngine and unittests/ExecutionEngine/JIT should be
suppressed. My r160610 intended to tweak tests on cross targets (not
to suppress, but to appease).

I wonder if we should honor the triple in Module, though.

Feel free to update, unless breaking tests, thank you.

...Takumi

Hi Takumi,

I'm a bit confused as to what is supposed to happen in the cross building scenarios. For instance, if host=x86_64-linux and target=i686-mingw32, what should the MCJIT tests do? Should they be suppressed because the architectures don't match? If so, what about the case where host=x86_64-linux and target=x86_64-mingw32?

I'm modifying the MCJIT tests so that they will provide an explicit target triple on the run line. In the case where the host OS is Windows, I'm appending "-elf" to the target triple. I think that should be sufficient to make things work in the cases where the host triple and the target triple are compatible, and then I can suppress the cases where host and target aren't compatible in the lit.local.cfg file.

Does that sound right?

My concern is that I don't quite know how to predict what will happen on some of the buildbots aside from checking something in and seeing what happens. Hopefully any obvious problems will be caught in code review.

Aside from the testing, it seems to me that TargetSelect should always use the Module target triple, and if it isn't compatible with the host environment then it will just fail.

-Andy

I'm a bit confused as to what is supposed to happen in the cross building scenarios. For instance, if host=x86_64-linux and target=i686-mingw32, what should the MCJIT tests do? Should they be suppressed because the architectures don't match? If so, what about the case where host=x86_64-linux and target=x86_64-mingw32?

Basically, I don't think local JIT could execute other environments.
Both {i686|x86_64}-mingw32 are incompatible to Linux, at least.

It should be suppressed unless the target could run as RemoteTarget.

BTW, do you think -target i686-linux should run under x86_64 binary?
(I wish so, but it would involve some issues...)

I'm modifying the MCJIT tests so that they will provide an explicit target triple on the run line. In the case where the host OS is Windows, I'm appending "-elf" to the target triple. I think that should be sufficient to make things work in the cases where the host triple and the target triple are compatible, and then I can suppress the cases where host and target aren't compatible in the lit.local.cfg file.

Does that sound right?

Do you mean; "-mtriple=%{targettriple_provided_by_lit}-elf" ?
I think MCJIT may reinterpret the triple to be accepted by elf.

My concern is that I don't quite know how to predict what will happen on some of the buildbots aside from checking something in and seeing what happens. Hopefully any obvious problems will be caught in code review.

I can investigate failures if they happened in my builders. All of my
builders are in my room :slight_smile:

Aside from the testing, it seems to me that TargetSelect should always use the Module target triple, and if it isn't compatible with the host environment then it will just fail.

It should be better that Target may be overridden. It was the reason
why I tweaked TargetSelect().

...Takumi

OK, so I'll modify selectTarget() to use the Module triple for MCJIT but LLVM_HOSTTRIPLE for the old JIT and interpreter.

I'm adding code to look for 'elf' in the environment part of the triple, so while that doesn't currently do anything for MCJIT, it will when I'm done.

I'm also trying to add something to the MCJIT lit.local.cfg to make sure the tests are only run on target-compatible hosts.

Thanks for your help.

-Andy