Skip to content

Commit 90cbc37

Browse files
authored
[DFAJumpThreading] Verify dominator tree by option (#163334)
Note that the test coverage misses the dominator tree verification. This patch controls verification by option, instead of using the EXPENSIVE_CHECKS macro.
1 parent 782a91e commit 90cbc37

File tree

7 files changed

+11
-8
lines changed

7 files changed

+11
-8
lines changed

llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1479,10 +1479,13 @@ bool DFAJumpThreading::run(Function &F) {
14791479
DTU->flush();
14801480

14811481
#ifdef EXPENSIVE_CHECKS
1482-
assert(DTU->getDomTree().verify(DominatorTree::VerificationLevel::Full));
14831482
verifyFunction(F, &dbgs());
14841483
#endif
14851484

1485+
if (MadeChanges && VerifyDomInfo)
1486+
assert(DTU->getDomTree().verify(DominatorTree::VerificationLevel::Full) &&
1487+
"Failed to maintain validity of domtree!");
1488+
14861489
return MadeChanges;
14871490
}
14881491

llvm/test/Transforms/DFAJumpThreading/dfa-constant-propagation.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2-
; RUN: opt -S -passes=dfa-jump-threading,sccp,simplifycfg %s | FileCheck %s
2+
; RUN: opt -S -passes=dfa-jump-threading,sccp,simplifycfg -verify-dom-info=1 %s | FileCheck %s
33

44
; This test checks that a constant propagation is applied for a basic loop.
55
; Related to bug 44679.

llvm/test/Transforms/DFAJumpThreading/dfa-jump-threading-analysis.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
; REQUIRES: asserts
2-
; RUN: opt -S -passes=dfa-jump-threading -debug-only=dfa-jump-threading -disable-output %s 2>&1 | FileCheck %s
3-
; RUN: opt -S -passes=dfa-jump-threading -print-prof-data %s -o - | FileCheck %s --check-prefix=PROFILE
2+
; RUN: opt -S -passes=dfa-jump-threading -verify-dom-info=1 -debug-only=dfa-jump-threading -disable-output %s 2>&1 | FileCheck %s
3+
; RUN: opt -S -passes=dfa-jump-threading -verify-dom-info=1 -print-prof-data %s -o - | FileCheck %s --check-prefix=PROFILE
44

55
; This test checks that the analysis identifies all threadable paths in a
66
; simple CFG. A threadable path includes a list of basic blocks, the exit

llvm/test/Transforms/DFAJumpThreading/dfa-jump-threading-transform.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals
2-
; RUN: opt -S -passes=dfa-jump-threading %s | FileCheck %s
2+
; RUN: opt -S -passes=dfa-jump-threading -verify-dom-info=1 %s | FileCheck %s
33

44
; These tests check that the DFA jump threading transformation is applied
55
; properly to two CFGs. It checks that blocks are cloned, branches are updated,

llvm/test/Transforms/DFAJumpThreading/dfa-unfold-select.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2-
; RUN: opt -S -passes=dfa-jump-threading -dfa-early-exit-heuristic=false %s | FileCheck %s
2+
; RUN: opt -S -passes=dfa-jump-threading -dfa-early-exit-heuristic=false -verify-dom-info=1 %s | FileCheck %s
33

44
; These tests check if selects are unfolded properly for jump threading
55
; opportunities. There are three different patterns to consider:

llvm/test/Transforms/DFAJumpThreading/equivalent-states.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 3
2-
; RUN: opt -S -passes=dfa-jump-threading %s | FileCheck %s
2+
; RUN: opt -S -passes=dfa-jump-threading -verify-dom-info=1 %s | FileCheck %s
33

44
declare void @do_something()
55
declare void @user(i32)

llvm/test/Transforms/DFAJumpThreading/single_succ_switch.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 3
2-
; RUN: opt -S -passes=dfa-jump-threading %s | FileCheck %s
2+
; RUN: opt -S -passes=dfa-jump-threading -verify-dom-info=1 %s | FileCheck %s
33

44
define void @pr60254() {
55
; CHECK-LABEL: define void @pr60254() {

0 commit comments

Comments
 (0)