[SimplifyCFG] ConstantFoldTerminator() already knows how to preserve DomTree

... so just ensure that we pass DomTreeUpdater it into it.

Fixes DomTree preservation for a number of tests,
all of which are marked as such so that they do not regress.
This commit is contained in:
Roman Lebedev 2020-12-17 20:13:03 +03:00
parent 164e0847a5
commit 2ee724863e
No known key found for this signature in database
GPG Key ID: 083C3EBB4A1689E0
9 changed files with 10 additions and 9 deletions

View File

@ -6322,7 +6322,8 @@ bool SimplifyCFGOpt::simplifyOnce(BasicBlock *BB) {
// Check to see if we can constant propagate this terminator instruction
// away...
Changed |= ConstantFoldTerminator(BB, true);
Changed |= ConstantFoldTerminator(BB, /*DeleteDeadConditions=*/true,
/*TLI=*/nullptr, DTU);
// Check for and eliminate duplicate PHI nodes in this block.
Changed |= EliminateDuplicatePHINodes(BB);

View File

@ -1,4 +1,4 @@
; RUN: opt < %s -simplifycfg -disable-output
; RUN: opt < %s -simplifycfg -simplifycfg-require-and-preserve-domtree=1 -disable-output
define void @symhash_add() {
entry:

View File

@ -1,4 +1,4 @@
; RUN: opt < %s -simplifycfg -disable-output
; RUN: opt < %s -simplifycfg -simplifycfg-require-and-preserve-domtree=1 -disable-output
; PR 2777
@g_103 = common global i32 0 ; <i32*> [#uses=1]

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
; PR9420
; Note that the crash in PR9420 test is sensitive to the ordering of

View File

@ -1,6 +1,6 @@
;; Check that we don't crash. PR37300.
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt %s -S -simplifycfg | FileCheck %s
; RUN: opt %s -S -simplifycfg -simplifycfg-require-and-preserve-domtree=1 | FileCheck %s
define void @patatino() {
; CHECK-LABEL: @patatino(

View File

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

View File

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

View File

@ -1,4 +1,4 @@
; RUN: opt %s -S -simplifycfg | FileCheck %s
; RUN: opt %s -S -simplifycfg -simplifycfg-require-and-preserve-domtree=1 | FileCheck %s
; Check for when one branch implies the value of a successors conditional and
; it's not simply the same conditional repeated.

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
; SimplifyCFG should eliminate redundant indirectbr edges.