[LLVMdev] is createCFGSimplificationPass unused?

Chris Lattner sabre at nondot.org
Thu Nov 2 18:36:47 PST 2006


On Thu, 2 Nov 2006, [UTF-8] Rafael Esp?ndola wrote:
> It looks like createCFGSimplificationPass was disabled on 2006/09/04.
> This causes some problems for architectures that use conditional moves
> to implement select (alpha and ARM). For example, on 2006/09/03 a "if
> (a) return 0; else return 1;" compiled to

> I have added createCFGSimplificationPass in
> ARMTargetMachine::addInstSelector to fix this problem. Is this the
> correct solution? I think that more architectures might benefit...

Please don't do that.  Instead, please implement the TargetInstrInfo 
branch analysis hooks so that the branch folding pass can do this. 
Given info about branches, the pass already does various things to 
optimize away many of the things that simplify cfg does.

I'm planning several extensions to the pass, in particular to support 
limited forms of "predication" (PPC's conditional return for sure, perhaps 
some better cmov formation, etc).  This may be generalizable for IA64/ARM, 
but it depends on how much time I have to work on it.

If there are specific cases like this where simplify cfg produces better 
code than branch folding (with the hooks implemented) please file 
bugzilla bugs to track them.

Long term, I'd like to get the code generator to the point where running 
the code generator doesn't modify from the input LLVM IR. Running 
llvm->llvm passes breaks this property.

Thanks,

-Chris

-- 
http://nondot.org/sabre/
http://llvm.org/



More information about the llvm-dev mailing list