forked from OSchip/llvm-project
[SimplifyCFG] Teach simplifySingleResume() to preserve DomTree
This commit is contained in:
parent
c209b88dd4
commit
b7d00e29b7
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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()
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue