The attached hand-written .ll file contains four BBs in an if-statement diamond. The %cond_true and %cond_false blocks are both very similar; all instructions are the same except for the parameter of the GEP which is the same type in either case. The optimization I'd like to see is that one change being folded away into a phi node and then the blocks getting merged into the %done block.
This is very similar to an optimization simplify-cfg does, and is also an example of partial redundancy elimination and instruction sinking. Where should this optimization belong?
b.ll
(530 bytes, text/plain)The attached hand-written .ll file contains four BBs in an if-statement diamond. The %cond_true and %cond_false blocks are both very similar; all instructions are the same except for the parameter of the GEP which is the same type in either case. The optimization I'd like to see is that one change being folded away into a phi node and then the blocks getting merged into the %done block.
This is very similar to an optimization simplify-cfg does, and is also an example of partial redundancy elimination and instruction sinking. Where should this optimization belong?