[LLVMdev] The Trouble with Triples

Daniel Sanders Daniel.Sanders at imgtec.com
Fri Jul 31 10:53:46 PDT 2015


> The triple still plays the part of the bare minimum in the new scheme,
> and that's not going away. But if we have more metadata, you can have
> better warnings/errors when linking IR.

I just want to check one more detail here. Suppose the IR is generated on one host and linked on another, and that these two hosts have different meanings for the triple (whether by accident or intention). I would expect the metadata to specify all values in the TargetTuple for this to behave the same way as generating and linking on one host. Do you agree?

The root of my concern is that the compatibility check could incorrectly say two modules are compatible because the meaning of the triple used to initialize the TargetTuple changed.
________________________________________
From: Renato Golin [renato.golin at linaro.org]
Sent: 31 July 2015 17:55
To: Daniel Sanders
Cc: Eric Christopher; LLVM Developers Mailing List (llvmdev at cs.uiuc.edu); Jim Grosbach (grosbach at apple.com)
Subject: Re: The Trouble with Triples

On 31 July 2015 at 17:47, Daniel Sanders <Daniel.Sanders at imgtec.com> wrote:
> After re-reading your last couple emails with the benefit of sleep, that all makes sense to me. The user/driver would be responsible for ensuring each tool is called with the same options, while each tool is responsible for using the same TargetTuple in all its calls to LLVM. The only bit I'm unsure about w.r.t to not having a serialization in the IR is the ModuleLinker where we currently have code to ensure that all the modules are compatible (by comparing the triple). Presumably, this code was added because there was a real possibility of having incompatible modules (i.e. different triples) so we shouldn't rely on the tool options here. For this the serialization via metadata makes sense to me. We can then compare and merge TargetTuples with target-appropriate leniency and/or strictness.

Exactly. That's why I suggested to not touch the triple and to add the
rest as metadata. So that previous versions of Clang could still
compile and link new IR and vice-versa.

The triple still plays the part of the bare minimum in the new scheme,
and that's not going away. But if we have more metadata, you can have
better warnings/errors when linking IR.

Each target will be able to choose whatever they think it's
appropriate and the rest will not have to cope with attributes they
don't understand, not the bloating that this would make.

cheers,
--renato




More information about the llvm-dev mailing list