This is an alternative to http://reviews.llvm.org/D9654
Stack probes are done in an loop in the prologue instead of calling external functions.
Note that when modifying basic blocks in the emitPrologue the epilog will be inserted into the wrong basic block. This is because
the basic blocks to insert epilogs into is calculated before
emitPrologue is called.
I fixed this by adding the following code after the emitPrologue call
in PEI::insertPrologEpilogCode:
RestoreBlocks.clear(); calculateSets(Fn);
This doesn't seem like a very nice solution.
Another thing is that I'm not sure that I modified all the test for stack probing correctly (there were quite a few cases of it).