[LLVMdev] standard passes
Duncan Sands
baldrick at free.fr
Mon Apr 14 13:05:01 PDT 2008
Hi,
> 1. Does -std-compile-opts of opt do the same optimization with llvm-gcc
> with -O[1-3] options?
almost but not quite. Firstly, llvm-gcc won't schedule all passes
unless the optimization level is high enough. It won't unroll loops
unless given -funroll-loops etc.
That said, there are a few curious differences between llvm-gcc and
opt. I'm not sure if they are intentional or a mistake:
- llvm-gcc schedules the SimplifyLibCalls pass near the beginning,
opt near the end.
- opt schedules DeadTypeElimination followed by ConstantMerge; while
llvm-gcc schedules ConstantMerge followed by StripDeadPrototypes.
So opt doesn't run StripDeadPrototypes while llvm-gcc
doesn't run DeadTypeElimination.
- opt schedules LowerSetJmp while llvm-gcc does not.
Finally, llvm-gcc runs the following passes on each function
immediately after it is created:
CFGSimplification, PromoteMemoryToRegister,
ScalarReplAggregates, InstructionCombining.
These sometimes mean you get better code from llvm-gcc than
from opt.
> If I want to debug into passes through llvm-gcc,
> how do I set a breakpoint right before pass execution? In my gdb
> llvm-gcc session, I don't have llvm::PassManager available.
Break on a line number in the appropriate file.
> 2. When I use "-p" with opt, there is nothing I can see from the
> output. Instead, "--debug-pass=Details" gives me more detailed info. Did
> I miss other stuffs that are required to be with "-p?"
I never managed to get -p to work. With opt I use -debug-pass=Arguments
and with llvm-gcc -fdebug-pass-arguments
Ciao,
Duncan.
More information about the llvm-dev
mailing list