[llvm-dev] Inconsistency in -march option between llc and clang

Renato Golin via llvm-dev llvm-dev at lists.llvm.org
Mon Aug 29 14:53:03 PDT 2016


On 29 August 2016 at 17:20, Suprateeka R Hegde via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
> But this needs to be documented well. Package developers need to very well
> understand this, Today I see that llc is used quite a lot of places
> specially in system software development. For instance, POCL (Portable
> OpenCL) uses clang and llc both. But tries to use the same value for -march
> and fails.

I think there's an interest in making the interfaces similar, not identical.

But, as Tim said, Clang operates on "architecture independent" source
files, while llc operates on *platform specific* IR. So, having a
strong triple / arch command line options for llc makes no sense, as
you shouldn't be messing around those flags in llc anyway.

You can easily get the *wrong* result and not notice, so having a
broken interface stops you from doing silly things. For example,
compile to x86_64 IR, then use -march=aarch64. This is bound to create
all sorts of silent problems, especially if you silence the warnings.

I'm not advocating for breaking one thing to fix the other, though.
All I'm saying is that, teaching people to "use" llc's interface may
take them into a place they don't want to be, and there will be no
easy error checks. So, if you're going down the path of using llc
inside another tool, I strongly recommend you to patch up llc's arch
validation mechanism (IR data layout/triple vs. command line options)
first, to make sure warnings and errors are what they must be.

cheers,
--renato


More information about the llvm-dev mailing list