[SimplifyCFG] Teach simplifySingleResume() to preserve DomTree

This commit is contained in:
Roman Lebedev 2020-12-19 16:52:54 +03:00
parent c209b88dd4
commit b7d00e29b7
No known key found for this signature in database
GPG Key ID: 083C3EBB4A1689E0
5 changed files with 9 additions and 6 deletions

View File

@ -4200,14 +4200,17 @@ bool SimplifyCFGOpt::simplifySingleResume(ResumeInst *RI) {
// Turn all invokes that unwind here into calls and delete the basic block.
for (pred_iterator PI = pred_begin(BB), PE = pred_end(BB); PI != PE;) {
BasicBlock *Pred = *PI++;
removeUnwindEdge(Pred);
removeUnwindEdge(Pred, DTU);
++NumInvokes;
}
// The landingpad is now unreachable. Zap it.
if (LoopHeaders)
LoopHeaders->erase(BB);
BB->eraseFromParent();
if (DTU)
DTU->deleteBB(BB);
else
BB->eraseFromParent();
return true;
}

View File

@ -1,4 +1,4 @@
; RUN: opt < %s -simplifycfg -S | FileCheck %s
; RUN: opt < %s -simplifycfg -simplifycfg-require-and-preserve-domtree=1 -S | FileCheck %s
; CHECK-NOT: invoke
; CHECK-NOT: landingpad

View File

@ -1,4 +1,4 @@
; RUN: opt -simplifycfg -disable-output < %s
; RUN: opt -simplifycfg -simplifycfg-require-and-preserve-domtree=1 -disable-output < %s
; END.
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
target triple = "x86_64-unknown-linux-gnu"

View File

@ -1,4 +1,4 @@
; RUN: opt < %s -simplifycfg -S | FileCheck %s
; RUN: opt < %s -simplifycfg -simplifycfg-require-and-preserve-domtree=1 -S | FileCheck %s
declare void @bar()

View File

@ -1,4 +1,4 @@
; RUN: opt < %s -simplifycfg -S | FileCheck %s
; RUN: opt < %s -simplifycfg -simplifycfg-require-and-preserve-domtree=1 -S | FileCheck %s
; CHECK-LABEL: define void @foo
define void @foo() personality i32 (...)* @__gxx_personality_v0 {