This is an archive of the discontinued LLVM Phabricator instance.

Better lit.cfg "native" detection
ClosedPublic

Authored by probinson on Aug 28 2015, 4:08 PM.

Diff Detail

Repository
rL LLVM

Event Timeline

probinson updated this revision to Diff 33480.Aug 28 2015, 4:08 PM
probinson retitled this revision from to Better lit.cfg "native" detection.
probinson updated this object.
probinson added a subscriber: llvm-commits.

I've tried this on X86 in several variations:

  • default target == host triple; DebugInfo tests all work fine
  • default target != host triple but X86 target included: DebugInfo tests all work fine
  • ARM target only, default target triple is ARM-ish: DebugInfo tests identified as UNSUPPORTED

Works for me, I don't know why the original had host arch == target arch , which is why I didn't remove it.
We can try to get this in and revert if we break someone's use case.

mehdi_amini accepted this revision.Aug 28 2015, 4:11 PM
mehdi_amini added a reviewer: mehdi_amini.
This revision is now accepted and ready to land.Aug 28 2015, 4:11 PM
This revision was automatically updated to reflect the committed changes.

Reverted in r246352.

Paul, I am sorry if you didn't understand the comment in r193459 that I wrote.

I got a report that the sanitizer-windows bot failed:
http://lab.llvm.org:8011/builders/sanitizer-windows/builds/9107
which appears to be due to this patch; thanks for reverting it for me!

The test that failed is in the compiler-rt project, which I don't have checked out.
I guess the problem is a lack of clarity about what "native" target actually means.
We apparently need both kinds of predicate:
(a) host triple == target triple, or more generally: The tools we are building can be used in turn to build programs that can execute on the host; and
(b) host_arch is one of the targets_to_build, which is sufficient for things like llc tests where llc defaults to using the host triple as the target triple, but the output files do not have to execute on the host.

Looking more thoroughly into the history, it appears that "native" was intended to mean (a) from the start, so if we want something that means (b) we'll need to invent it as a new feature.

Since LLVM(and clang) is "the native cross compiler", it shouldn't depend on host architecture in most cases.
I wonder there might be any cases that requires (b).

(a) also implies like "--host=x86_64-linux --target=i686-linux".
It would require remote process executing, though.

Since LLVM(and clang) is "the native cross compiler", it shouldn't depend on host architecture in most cases.
I wonder there might be any cases that requires (b).

Yes. Various tools (including llc and others) will use the host-triple as the default-target-triple, but for non-executable tests (like most of Clang/LLVM tests) it is sufficient to have the host-arch included in targets_to_build.
This is exactly the problem that I had: Mehdi added the "native" condition to DebugInfo tests, which disabled them for my cross-compiler (running on x86_64 Windows and targeting x86_64 PS4). That is not acceptable.

What test in LLVM is sensitive to the "native" definition a)?

In D12454#235795, @joker.eph wrote:

What test in LLVM is sensitive to the "native" definition a)?

JIT tests, for now.

I see: lli will use the "default target triple". If you build LLVM with a default triple being ARM and you're on an X86 machine it can't run.

But what is not clear to me is that since lli was compiled using the host triple, why would it uses the default target triple? I'm not sure I see the use case here.

Re-reading the thread, you mentioned "--host=x86_64-linux --target=i686-linux". Is it like building lli to run in 64bits mode but having the JIT'ed code being 32 bits?

JIT stuff uses host triple rather than LLVM_DEFAULT_TARGET_TRIPLE by default, for now.
(It might be improved in future)

With "host=x86_64-linux target=i686", almost all JIT tests would pass.
But I thinks they would be *false positive* since they don't check functionality of i686.

I'm lost and I feel you are contradicting yourself, you are saying now that the JIT tests are using the host triple, but then I don't understand why did you need to revert r246350?

Excuse me to confuse you.
AFAIK, "Most of JIT tests would fail with different target triple".
I have no idea whether would be cleaner,

  • Rollback using host triple into target triple in JIT, and let JIT fail with inappropriate target.
  • Tweak JIT and around to run with host triple as target. I guess some part would depend on target_triple.

I'd dig around it when I have time.