[llvm-dev] Is there a way to pass Optimization passes to clang?

serge guelton via llvm-dev llvm-dev at lists.llvm.org
Wed Dec 2 11:09:40 PST 2015

On Wed, Dec 02, 2015 at 12:42:44PM -0600, Bill Seurer via llvm-dev wrote:
> On 12/02/15 11:56, Phil Tomson via llvm-dev wrote:
> >Note: I realize there must be a way to break everything up into stages
> >and use /opt/ at some point and pass the optimization command line
> >options to it, but I've got a pretty large set of Makefiles which would
> >need to change to do that.
> Using opt is the way to go.
> For your Makefile issue write your own "clang" script that is ahead of the
> real clang.  Have it run clang/opt/llc for you and then you can easily
> change the optimization phases for opt.

If you're planning to call your own passes, you can also register them
for clang use, as described in the tutorial we gave at LLVM DEV 2015.
See for instance:


More information about the llvm-dev mailing list