Currently, if you have BitCode that does not
specify a target, it gets a default architecture.
This is especially odd if you are doing
llvm-ld -native
but it first applies optimizations for
a target other than what it is currently compiling for.
Ideally, target-specific optimizations wouldn't be
applied until a target was given.
This would allow simple programs to be target-agnostic.
(And therefore more likely to work for newcomers.)
Why is there a default target?
Why can't those optimizations just be skipped until there is one?
(To be clear: I am assuming there is a reason for this.
I am asking what it is.)
Especially in the case of llvm-ld -native,
why doesn't it set the target to the platform
it is compiling for?
Failing that, it could use the platform it is
currently running on as the target.
Currently, if you have BitCode that does not
specify a target, it gets a default architecture.
This is especially odd if you are doing
llvm-ld -native
but it first applies optimizations for
a target other than what it is currently compiling for.
there has been some work on this, especially for "opt",
but I don't know the status.
Why is there a default target?
Why can't those optimizations just be skipped until there is one?
(To be clear: I am assuming there is a reason for this.
I am asking what it is.)
This has recently been fixed on trunk. The opt tool no longer adds a
default target if a Module has no target attributes, and the optimizers
now know how to be conservative when there's no target information.
Especially in the case of llvm-ld -native,
why doesn't it set the target to the platform
it is compiling for?
This sounds like it could be called a bug. Please file a bugzilla report.
Why is there a default target?
Why can't those optimizations just be skipped until there is one?
(To be clear: I am assuming there is a reason for this.
I am asking what it is.)
This has recently been fixed on trunk. The opt tool no longer adds a
default target if a Module has no target attributes, and the optimizers
now know how to be conservative when there's no target information.
Great. That should make everything a lot easier.
Especially in the case of llvm-ld -native,
why doesn't it set the target to the platform
it is compiling for?
This sounds like it could be called a bug. Please file a bugzilla report.