llvm.org GIT mirror llvm / 67e13d6
Revert EH-specific checks in BranchFolding that were causing blow ups in compile time. Differential Revision: https://reviews.llvm.org/D22839 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276898 91177308-0d34-0410-b5e6-96231b3b80d8 Andrew Kaylor 4 years ago
3 changed file(s) with 28 addition(s) and 35 deletion(s). Raw diff Collapse all Expand all
15941594 // removed, move this block to the end of the function.
15951595 MachineBasicBlock *PrevTBB = nullptr, *PrevFBB = nullptr;
15961596 SmallVector PrevCond;
1597 // We're looking for cases where PrevBB could possibly fall through to
1598 // FallThrough, but if FallThrough is an EH pad that wouldn't be useful
1599 // so here we skip over any EH pads so we might have a chance to find
1600 // a branch target from PrevBB.
1601 while (FallThrough != MF.end() && FallThrough->isEHPad())
1602 ++FallThrough;
1603 // Now check to see if the current block is sitting between PrevBB and
1604 // a block to which it could fall through.
16051597 if (FallThrough != MF.end() &&
16061598 !TII->analyzeBranch(PrevBB, PrevTBB, PrevFBB, PrevCond, true) &&
16071599 PrevBB.isSuccessor(&*FallThrough)) {
4949 ; CXX-NEXT: .long 1
5050 ; CXX-NEXT: .long .Ltmp1@IMGREL+1
5151 ; CXX-NEXT: .long -1
52 ; CXX-NEXT: .long "?catch$3@?0?test@4HA"@IMGREL
52 ; CXX-NEXT: .long "?catch$2@?0?test@4HA"@IMGREL
5353 ; CXX-NEXT: .long 2
5454 ; CXX-NEXT: .long .Ltmp2@IMGREL+1
5555 ; CXX-NEXT: .long 3
5656 ; CXX-NEXT: .long .Ltmp3@IMGREL+1
5757 ; CXX-NEXT: .long 2
58 ; CXX-NEXT: .long "?catch$5@?0?test@4HA"@IMGREL
58 ; CXX-NEXT: .long "?catch$4@?0?test@4HA"@IMGREL
5959 ; CXX-NEXT: .long 4
6060
6161 ; SEH-LABEL: test:
6363 ; SEH-NEXT: .long .Ltmp0@IMGREL+1
6464 ; SEH-NEXT: .long .Ltmp1@IMGREL+1
6565 ; SEH-NEXT: .long dummy_filter@IMGREL
66 ; SEH-NEXT: .long .LBB0_3@IMGREL
66 ; SEH-NEXT: .long .LBB0_2@IMGREL
6767 ; SEH-NEXT: .long .Ltmp0@IMGREL+1
6868 ; SEH-NEXT: .long .Ltmp1@IMGREL+1
6969 ; SEH-NEXT: .long dummy_filter@IMGREL
70 ; SEH-NEXT: .long .LBB0_5@IMGREL
70 ; SEH-NEXT: .long .LBB0_4@IMGREL
7171 ; SEH-NEXT: .long .Ltmp2@IMGREL+1
7272 ; SEH-NEXT: .long .Ltmp3@IMGREL+1
73 ; SEH-NEXT: .long "?dtor$2@?0?test@4HA"@IMGREL
73 ; SEH-NEXT: .long "?dtor$5@?0?test@4HA"@IMGREL
7474 ; SEH-NEXT: .long 0
7575 ; SEH-NEXT: .long .Ltmp2@IMGREL+1
7676 ; SEH-NEXT: .long .Ltmp3@IMGREL+1
7777 ; SEH-NEXT: .long dummy_filter@IMGREL
78 ; SEH-NEXT: .long .LBB0_5@IMGREL
78 ; SEH-NEXT: .long .LBB0_4@IMGREL
7979 ; SEH-NEXT: .Llsda_end0:
282282 ; }
283283 ; }
284284 ;
285 ; CHECK-LABEL: test2: # @test2
286 ; CHECK-NEXT: [[test2_begin:.*func_begin.*]]:
287285 define void @test2() personality i8* bitcast (void ()* @ProcessCLRException to i8*) {
288286 entry:
289 ; CHECK: .seh_endprologue
290 ; CHECK: [[test2_before_f1:.+]]:
291 ; CHECK-NEXT: movl $1, %ecx
292 ; CHECK-NEXT: callq f
293 ; CHECK-NEXT: [[test2_after_f1:.+]]:
294287 invoke void @f(i32 1)
295288 to label %exit unwind label %fault
296289 fault:
297 ; CHECK: .seh_proc [[test2_fault:[^ ]+]]
298290 %fault.pad = cleanuppad within none [i32 undef]
299 ; CHECK: .seh_endprologue
300 ; CHECK: [[test2_before_f2:.+]]:
301 ; CHECK-NEXT: movl $2, %ecx
302 ; CHECK-NEXT: callq f
303 ; CHECK-NEXT: [[test2_after_f2:.+]]:
304291 invoke void @f(i32 2) ["funclet"(token %fault.pad)]
305292 to label %unreachable unwind label %exn.dispatch.inner
306293 exn.dispatch.inner:
307294 %catchswitch.inner = catchswitch within %fault.pad [label %catch1] unwind label %exn.dispatch.outer
308295 catch1:
309296 %catch.pad1 = catchpad within %catchswitch.inner [i32 1]
310 ; CHECK: .seh_proc [[test2_catch1:[^ ]+]]
311297 catchret from %catch.pad1 to label %unreachable
312298 exn.dispatch.outer:
313299 %catchswitch.outer = catchswitch within none [label %catch2] unwind to caller
314300 catch2:
315301 %catch.pad2 = catchpad within %catchswitch.outer [i32 2]
316 ; CHECK: .seh_proc [[test2_catch2:[^ ]+]]
317302 catchret from %catch.pad2 to label %exit
318303 exit:
319304 ret void
320305 unreachable:
321306 unreachable
307 }
308 ; CHECK-LABEL: test2: # @test2
309 ; CHECK-NEXT: [[test2_begin:.*func_begin.*]]:
310 ; CHECK: .seh_endprologue
311 ; CHECK: [[test2_before_f1:.+]]:
312 ; CHECK-NEXT: movl $1, %ecx
313 ; CHECK-NEXT: callq f
314 ; CHECK-NEXT: [[test2_after_f1:.+]]:
315 ; CHECK: .seh_proc [[test2_catch1:[^ ]+]]
316 ; CHECK: .seh_proc [[test2_catch2:[^ ]+]]
317 ; CHECK: .seh_proc [[test2_fault:[^ ]+]]
318 ; CHECK: .seh_endprologue
319 ; CHECK: [[test2_before_f2:.+]]:
320 ; CHECK-NEXT: movl $2, %ecx
321 ; CHECK-NEXT: callq f
322 ; CHECK-NEXT: [[test2_after_f2:.+]]:
322323 ; CHECK: [[test2_end:.*func_end.*]]:
323 }
324
324325
325326 ; Now check for EH table in xdata (following standard xdata)
326327 ; CHECK-LABEL: .section .xdata
327328 ; standard xdata comes here
328329 ; CHECK: .long 3{{$}}
329330 ; ^ number of funclets
330 ; CHECK-NEXT: .long [[test2_fault]]-[[test2_begin]]
331 ; ^ offset from L_begin to start of 1st funclet
332331 ; CHECK-NEXT: .long [[test2_catch1]]-[[test2_begin]]
333332 ; ^ offset from L_begin to start of 2nd funclet
334333 ; CHECK-NEXT: .long [[test2_catch2]]-[[test2_begin]]
335334 ; ^ offset from L_begin to start of 3rd funclet
335 ; CHECK-NEXT: .long [[test2_fault]]-[[test2_begin]]
336 ; ^ offset from L_begin to start of 1st funclet
336337 ; CHECK-NEXT: .long [[test2_end]]-[[test2_begin]]
337338 ; ^ offset from L_begin to end of last funclet
338339 ; CHECK-NEXT: .long 4
346347 ; ^ offset of end of clause
347348 ; CHECK-NEXT: .long [[test2_fault]]-[[test2_begin]]
348349 ; ^ offset of start of handler
349 ; CHECK-NEXT: .long [[test2_catch1]]-[[test2_begin]]
350 ; CHECK-NEXT: .long [[test2_end]]-[[test2_begin]]
350351 ; ^ offset of end of handler
351352 ; CHECK-NEXT: .long 0
352353 ; ^ type token slot (null for fault)
359360 ; ^ offset of end of clause
360361 ; CHECK-NEXT: .long [[test2_catch2]]-[[test2_begin]]
361362 ; ^ offset of start of handler
362 ; CHECK-NEXT: .long [[test2_end]]-[[test2_begin]]
363 ; CHECK-NEXT: .long [[test2_fault]]-[[test2_begin]]
363364 ; ^ offset of end of handler
364365 ; CHECK-NEXT: .long 2
365366 ; ^ type token of catch (from catchpad)
388389 ; ^ offset of end of clause
389390 ; CHECK-NEXT: .long [[test2_catch2]]-[[test2_begin]]
390391 ; ^ offset of start of handler
391 ; CHECK-NEXT: .long [[test2_end]]-[[test2_begin]]
392 ; CHECK-NEXT: .long [[test2_fault]]-[[test2_begin]]
392393 ; ^ offset of end of handler
393394 ; CHECK-NEXT: .long 2
394395 ; ^ type token of catch (from catchpad)