> Could I convince you to have a look at the transactional-memory branch > test libitm/testsuite/libitm.c++/eh-1.C? I'm getting > > z.c:36:1: error: edge void f1()->void* __cxa_allocate_exception(long > unsigned int) has no corresponding call_stmt > D.2114_4 = __cxa_allocate_exception (4); > > z.c:36:1: error: edge void f1()->void __cxa_throw(void*, void*, void > (*)(void*)) has no corresponding call_stmt > __cxa_throw (D.2114_4, &_ZTIi, 0B); > > void f1()/10(-1) @0x7ffff2d75500 availability:available 32 time, 10 > benefit 14 size, 1 benefit reachable body finalized > called by: void f2()/1 (1.00 per call) (can throw external) > calls: void _ITM_cxa_throw(void*, void*, void (*)(void*))/12 (1.00 > per call) (can throw external) void* _ITM_cxa_allocate_exception(long > unsigned int)/11 (1.00 per call) void* __cxa_allocate_exception(long > unsigned int)/8 (1.00 per call) void __cxa_throw(void*, void*, void > (*)(void*))/9 (1.00 per call) (can throw external) > z.c:36:1: internal compiler error: verify_cgraph_node failed > > This happens because cgraph_copy_node_for_versioning duplicated all of > the callee edges from the original function, and > tree_function_versioning created new edges when copying the body of the > function instead of updating the edges we duplicated. > > Frankly, the unholy mess of edge update options has me stumped. I have > no idea what's going on in this area. Why bother with any of it anyway? > Why not just always create all new callee edges when instantiating the > new body?
Well, while doing main IPA passes, we need to preserve information attached to edges, so we want to copy them and not create all of them from scratch. So the basic idea is to duplicate all the edges with old statement and when new statements are created, tree_function_versioning should update the call_stmt and create new edges only when new call really appears (it is possible when we do constant propagation or such). When you are not copying the whole function body, you will need to remove those edges that are outside region being duplicated, perhaps that is the problem? I will try to look into this. Honza > > > r~