Skip to content

Commit 2ee7248

Browse files
committed
[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.
1 parent 164e084 commit 2ee7248

File tree

9 files changed

+10
-9
lines changed

9 files changed

+10
-9
lines changed

llvm/lib/Transforms/Utils/SimplifyCFG.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6322,7 +6322,8 @@ bool SimplifyCFGOpt::simplifyOnce(BasicBlock *BB) {
63226322

63236323
// Check to see if we can constant propagate this terminator instruction
63246324
// away...
6325-
Changed |= ConstantFoldTerminator(BB, true);
6325+
Changed |= ConstantFoldTerminator(BB, /*DeleteDeadConditions=*/true,
6326+
/*TLI=*/nullptr, DTU);
63266327

63276328
// Check for and eliminate duplicate PHI nodes in this block.
63286329
Changed |= EliminateDuplicatePHINodes(BB);

llvm/test/Transforms/SimplifyCFG/2004-12-10-SimplifyCFGCrash.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
; RUN: opt < %s -simplifycfg -disable-output
1+
; RUN: opt < %s -simplifycfg -simplifycfg-require-and-preserve-domtree=1 -disable-output
22

33
define void @symhash_add() {
44
entry:

llvm/test/Transforms/SimplifyCFG/2008-09-08-MultiplePred.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
; RUN: opt < %s -simplifycfg -disable-output
1+
; RUN: opt < %s -simplifycfg -simplifycfg-require-and-preserve-domtree=1 -disable-output
22
; PR 2777
33
@g_103 = common global i32 0 ; <i32*> [#uses=1]
44

llvm/test/Transforms/SimplifyCFG/2011-03-08-UnreachableUse.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
; RUN: opt < %s -simplifycfg -S | FileCheck %s
1+
; RUN: opt < %s -simplifycfg -simplifycfg-require-and-preserve-domtree=1 -S | FileCheck %s
22
; PR9420
33

44
; Note that the crash in PR9420 test is sensitive to the ordering of

llvm/test/Transforms/SimplifyCFG/fold-debug-info.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
;; Check that we don't crash. PR37300.
22
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
3-
; RUN: opt %s -S -simplifycfg | FileCheck %s
3+
; RUN: opt %s -S -simplifycfg -simplifycfg-require-and-preserve-domtree=1 | FileCheck %s
44

55
define void @patatino() {
66
; CHECK-LABEL: @patatino(

llvm/test/Transforms/SimplifyCFG/implied-cond-matching-false-dest.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
; RUN: opt %s -S -simplifycfg | FileCheck %s
1+
; RUN: opt %s -S -simplifycfg -simplifycfg-require-and-preserve-domtree=1 | FileCheck %s
22

33
declare void @is(i1)
44

llvm/test/Transforms/SimplifyCFG/implied-cond-matching.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
; RUN: opt %s -S -simplifycfg | FileCheck %s
1+
; RUN: opt %s -S -simplifycfg -simplifycfg-require-and-preserve-domtree=1 | FileCheck %s
22

33
declare void @dead()
44
declare void @alive()

llvm/test/Transforms/SimplifyCFG/implied-cond.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
; RUN: opt %s -S -simplifycfg | FileCheck %s
1+
; RUN: opt %s -S -simplifycfg -simplifycfg-require-and-preserve-domtree=1 | FileCheck %s
22
; Check for when one branch implies the value of a successors conditional and
33
; it's not simply the same conditional repeated.
44

llvm/test/Transforms/SimplifyCFG/indirectbr.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
; RUN: opt -S -simplifycfg < %s | FileCheck %s
1+
; RUN: opt -S -simplifycfg -simplifycfg-require-and-preserve-domtree=1 < %s | FileCheck %s
22

33
; SimplifyCFG should eliminate redundant indirectbr edges.
44

0 commit comments

Comments
 (0)