[LLVMdev] Strange LLVM Crash

Eric Christopher echristo at apple.com
Sun Mar 15 18:37:06 PDT 2009


On Mar 15, 2009, at 6:31 PM, Nyx wrote:

>
> This is what I have so far:
>
> 	// Add optimization passes to the function passes
> 	s_pFunctionPasses->add(new llvm::TargetData(s_pModule));
> 	s_pFunctionPasses->add(llvm::createCFGSimplificationPass());
> 	s_pFunctionPasses->add(llvm::createPromoteMemoryToRegisterPass());
> 	s_pFunctionPasses->add(llvm::createConstantPropagationPass());
> 	s_pFunctionPasses->add(llvm::createDeadCodeEliminationPass());
> 	s_pFunctionPasses->add(llvm::createInstructionCombiningPass());
>
> Where s_pFunctionPasses is a FunctionPassManager I create when  
> initializing
> my program and delete at shutdown. I'm running the CFG  
> simplification one
> first in the hope that it will speed up the passes that follow it.
>

I'd swap it and mem2reg, but otherwise it looks ok. You can also add  
GVN if you can spare the time.

> Just to make sure I understand: I shouldn't add x86 optimization  
> passes
> myself, LLVM will take care of running the appropriate ones for me,  
> is that
> correct? If it's incorrect, how do I manage those passes?

Unless you have some x86 specific machine code pass that you wrote and  
need to run, then no, you don't need to worry about it.  
getPointerToFunction() should handle all of that.

-eric



More information about the llvm-dev mailing list