[LLVMdev] "Refactoring" Basic Blocks into a new function

Vikram Adve vadve at cs.uiuc.edu
Wed Apr 20 06:46:42 PDT 2005


On Apr 20, 2005, at 7:33 AM, Evan Jones wrote:

> Yuck. This is what I was afraid of. I do *not* necessarily have 
> begin/end markers in the same basic block. In fact, it would be quite 
> unusual that they would be in the same basic block. There are likely 
> to be intervening conditionals or loops.  From this comment, it seems 
> to me that I need to collect my vector of BasicBlocks in a "smarter" 
> fashion by actually tracing the control flow from the "begin" marker 
> through to the "end" marker. Am I right about this?
>

It sounds that way.  Try the df_ext_iterator to trace control flow 
paths forward from the begin() in linear time.  
lib/Transforms/Scalar/ADCE.cpp seems to have an example of using it.

--Vikram
http://www.cs.uiuc.edu/~vadve
http://llvm.cs.uiuc.edu/





More information about the llvm-dev mailing list