[llvm-dev] Is the correct behavior of getelementptr i192* for opt + llc -march=aarch64?

Renato Golin via llvm-dev llvm-dev at lists.llvm.org
Fri Nov 11 03:04:31 PST 2016


On 10 November 2016 at 04:29, MITSUNARI Shigeo via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
>>Is your default target aarch64?  Otherwise opt may be assuming a different
>>target which might explain the difference.
>
> No, My target is x86-64, x86, arm, aarch64, ..., then I'll avoid using i192* and datalayout.

I believe Tom's point was about the line:

% opt-3.8 -O3 a.ll -o - | llc-3.8 -O3 -o - -march=aarch64

If your host is x86_64, then the first call to opt will assume x86_64
unless you have a triple in the IR (which I believe you didn't).

You can override with:

% opt-3.8 -march=aarch64 -O3 a.ll -o - | llc-3.8 -O3 -o - -march=aarch64

Or making sure your IR always have triple+layout.

I'm not sure it would have made any difference on the i192* case, but
it will have noticeable impact on more complicated (and more target
specific) IR, so you should be careful.

Also, don't assume that OPT+LLC == LLC, as you'll be running more of
the same passes on the first case, which can, in rare cases, have an
impact (for better or worse) on the code generated.

I recommend you keep the passes to a minimum. Opt is a debug tool, not
an optimiser.

To generate target code, use llc directly, which will (should) have
the same effect without command line flag duplication. Better still,
use Clang, or make sure your own front-end uses the middle and back
ends in a consistent way, and use it instead of llc.

cheers,
--renato


More information about the llvm-dev mailing list