[LLVMdev] Critical edges

Fernando Magno Quintao Pereira fernando at CS.UCLA.EDU
Tue Jul 4 14:59:45 PDT 2006


Hi,

    I am able to remove the critical edges now. I only had to insert the
line below in PPCTargetmachine.cpp.

  PM.add(createBreakCriticalEdgesPass());

However, it does not remove all the critical edges. I am getting a very
weird dataflow graph (even without the Break Critical edges pass). The
dataflow generated by MachineFunction::dump() for the program below is
given here:
http://compilers.cs.ucla.edu/fernando/projects/soc/images/loop_no_crit2.pdf

int main(int argc, char **argv) {
    int result = 0;
    int counter = argc;
    while(counter > 0) {
        if(counter % 3 == 0) {
            result--;
        } else {
            result++;
        }
        counter = counter - 1;
    }
    printf("Result = %d\n", result);
}

The problem is the no_exit block. I think it was changed by one of the
optimization passes, and was split into three basic blocks. But now there
is a phi function where both the parameters are defined in the same basic
block. Any of you guys now which pass I should cut off if I want to avoid
this optimization?

Thanks,

Fernando



More information about the llvm-dev mailing list