forked from OSchip/llvm-project
[Attributor][NFC] Do not delete dead blocks but "clear" them
Deleting blocks will require us to deal with dead edges, e.g., `br i1 false, label %live, label %dead` explicitly. For now we just clear the blocks and move on. This will be revisited once we actually fold branches.
This commit is contained in:
parent
fe799c97fa
commit
5e442a51bc
|
@ -4644,9 +4644,12 @@ ChangeStatus Attributor::run(Module &M) {
|
|||
SmallVector<BasicBlock *, 8> ToBeDeletedBBs;
|
||||
ToBeDeletedBBs.reserve(NumDeadBlocks);
|
||||
ToBeDeletedBBs.append(ToBeDeletedBlocks.begin(), ToBeDeletedBlocks.end());
|
||||
DeleteDeadBlocks(ToBeDeletedBBs);
|
||||
STATS_DECLTRACK(AAIsDead, BasicBlock,
|
||||
"Number of dead basic blocks deleted.");
|
||||
// Actually we do not delete the blocks but squash them into a single
|
||||
// unreachable but untangling branches that jump here is something we need
|
||||
// to do in a more generic way.
|
||||
DetatchDeadBlocks(ToBeDeletedBBs, nullptr);
|
||||
STATS_DECL(AAIsDead, BasicBlock, "Number of dead basic blocks deleted.");
|
||||
BUILD_STAT_NAME(AAIsDead, BasicBlock) += ToBeDeletedBlocks.size();
|
||||
}
|
||||
|
||||
STATS_DECL(AAIsDead, Function, "Number of dead functions deleted.");
|
||||
|
|
|
@ -56,7 +56,6 @@ entry:
|
|||
call void @no_return_call()
|
||||
; CHECK: call void @no_return_call()
|
||||
; CHECK-NEXT: unreachable
|
||||
; CHECK-NEXT: }
|
||||
call i32 @dead_internal_func(i32 10)
|
||||
%cmp = icmp eq i32 %a, 0
|
||||
br i1 %cmp, label %cond.true, label %cond.false
|
||||
|
@ -130,7 +129,6 @@ cond.false: ; preds = %entry
|
|||
; CHECK: call void @no_return_call()
|
||||
; CHECK-NEXT: unreachable
|
||||
call i32 @dead_internal_func(i32 10)
|
||||
; CHECK-NEXT: }
|
||||
%call1 = call i32 @bar()
|
||||
br label %cond.end
|
||||
|
||||
|
@ -526,7 +524,6 @@ define linkonce_odr void @non_exact3() {
|
|||
; CHECK-NEXT: call void @non_dead_d15()
|
||||
; CHECK-NEXT: %nr = call i32 @foo_noreturn()
|
||||
; CHECK-NEXT: unreachable
|
||||
; CHECK-NEXT: }
|
||||
|
||||
define internal void @non_dead_a0() { ret void }
|
||||
define internal void @non_dead_a1() { ret void }
|
||||
|
|
Loading…
Reference in New Issue