Manipulate order of optimizations in llvm-ld

Hi,

I've written a couple of passes, and I intend to use them using llvm-ld (loading works fine). However, I can't seem to figure out how to put them first, i.e. before all other optimizations (inlining, internalizing, ... should only kick in after my passes).

Omitting AnalysisUsage::setPreservesAll() doesn't help and there is no AnalysisUsage::invalidateAll(). Does anybody know a workaround?

Kind regards,

Bram Adams
GH-SEL, INTEC, Ghent University (Belgium)

One solution is to use gccld/llvm-ld with the -disable-opt option, then run a completely custom series of passes with "opt".

-Chris

Hi Bram,

Hi,

I've written a couple of passes, and I intend to use them using llvm-ld
(loading works fine).

That's good to hear :slight_smile:

However, I can't seem to figure out how to put
them first, i.e. before all other optimizations (inlining,
internalizing, ... should only kick in after my passes).

I don't think you can. llvm-ld's always going to give you at least a
verifier and TargetData pass. See tools/llvm-ld/Optimize.cpp for the
details. If you pass --disable-opt it will put yours first, but then
you're responsible for doing the things that llvm-ld normally does.

Omitting AnalysisUsage::setPreservesAll() doesn't help and there is no
AnalysisUsage::invalidateAll(). Does anybody know a workaround?

--disable-opt or change Optimize.cpp :slight_smile:

Reid.

Hi,

I don't think you can. llvm-ld's always going to give you at least a
verifier and TargetData pass.

Those passes don't hurt ...

See tools/llvm-ld/Optimize.cpp for the
details. If you pass --disable-opt it will put yours first, but then
you're responsible for doing the things that llvm-ld normally does.

... so this approach did the trick for me.

Thanks (also to Chris),

Bram Adams
GH-SEL, INTEC, Ghent University (Belgium)