comparing -O5 to -std-compile-opts

Let's say I have 2 bytecode files, X.bc and Y.bc that I want to combine
into Z.bc. Which of the following command sequences will produce more
optimized code?

Sequence 1:
   llvm-link -o tmp.bc X.bc Y.bc
   opt -std-compile-opts -o Z.bc tmp.bc

Sequence 2:
   llvm-ld -O5 -o Z.bc X.bc Y.bc

Without looking at details it seems like sequence 2 should produce the
most optimized code. As a follow up, where does -std-compile-opts fall
within -O1 to -O5?

Thanks,
Ryan

Let's say I have 2 bytecode files, X.bc and Y.bc that I want to combine
into Z.bc. Which of the following command sequences will produce more
optimized code?

Sequence 1:
  llvm-link -o tmp.bc X.bc Y.bc
  opt -std-compile-opts -o Z.bc tmp.bc

Sequence 2:
  llvm-ld -O5 -o Z.bc X.bc Y.bc

These are very different options. :slight_smile:

Option #1 runs the "compile time" optimizations again at link time. Option #2 runs a different set of optimizations, more tuned for link-time-optimization.

Without looking at details it seems like sequence 2 should produce the
most optimized code. As a follow up, where does -std-compile-opts fall
within -O1 to -O5?

-std-compile-opts is roughly similar to GCC -O3. llvm-ld has no analog to GCC.

-Chris