Author: Roman Lebedev Date: 2020-12-17T01:03:49+03:00 New Revision: 49dac4aca0a13960f1aa46a20b11765992a9196c
URL: https://github.com/llvm/llvm-project/commit/49dac4aca0a13960f1aa46a20b11765992a9196c DIFF: https://github.com/llvm/llvm-project/commit/49dac4aca0a13960f1aa46a20b11765992a9196c.diff LOG: [SimplifyCFG] MergeBlockIntoPredecessor() already knows how to preserve DomTree ... so just ensure that we pass DomTreeUpdater it into it. Fixes DomTree preservation for a large number of tests, all of which are marked as such so that they do not regress. Added: Modified: llvm/include/llvm/Transforms/Utils/Local.h llvm/lib/Target/AMDGPU/AMDGPUUnifyDivergentExitNodes.cpp llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp llvm/lib/Transforms/Utils/SimplifyCFG.cpp llvm/test/Transforms/ADCE/basictest.ll llvm/test/Transforms/ADCE/unreachable.ll llvm/test/Transforms/GlobalDCE/deadblockaddr.ll llvm/test/Transforms/IndVarSimplify/exit_value_tests.ll llvm/test/Transforms/InstCombine/2003-08-12-AllocaNonNull.ll llvm/test/Transforms/InstCombine/2009-01-19-fmod-constant-float-specials.ll llvm/test/Transforms/InstCombine/2009-01-19-fmod-constant-float.ll llvm/test/Transforms/InstCombine/bittest.ll llvm/test/Transforms/JumpThreading/no-irreducible-loops.ll llvm/test/Transforms/LICM/2003-02-27-PreheaderProblem.ll llvm/test/Transforms/LoopInterchange/interchange-no-deps.ll llvm/test/Transforms/LoopSimplify/2003-08-15-PreheadersFail.ll llvm/test/Transforms/LoopVectorize/AArch64/aarch64-predication.ll llvm/test/Transforms/LoopVectorize/PowerPC/widened-massv-vfabi-attr.ll llvm/test/Transforms/LoopVectorize/X86/pr42674.ll llvm/test/Transforms/SCCP/2003-06-24-OverdefinedPHIValue.ll llvm/test/Transforms/SCCP/calltest.ll llvm/test/Transforms/SimplifyCFG/2002-05-21-PHIElimination.ll llvm/test/Transforms/SimplifyCFG/2003-03-07-DominateProblem.ll llvm/test/Transforms/SimplifyCFG/2005-08-01-PHIUpdateFail.ll llvm/test/Transforms/SimplifyCFG/2006-02-17-InfiniteUnroll.ll llvm/test/Transforms/SimplifyCFG/2007-11-22-InvokeNoUnwind.ll llvm/test/Transforms/SimplifyCFG/2008-05-16-PHIBlockMerge.ll llvm/test/Transforms/SimplifyCFG/PHINode.ll llvm/test/Transforms/SimplifyCFG/PhiEliminate3.ll llvm/test/Transforms/SimplifyCFG/X86/merge-cleanuppads.ll llvm/test/Transforms/SimplifyCFG/X86/unreachable-blocks.ll llvm/test/Transforms/SimplifyCFG/branch-fold-test.ll llvm/test/Transforms/SimplifyCFG/branch-phi-thread.ll llvm/test/Transforms/SimplifyCFG/dbginfo.ll llvm/test/Transforms/SimplifyCFG/dce-cond-after-folding-terminator.ll llvm/test/Transforms/SimplifyCFG/debug-info-thread-phi.ll llvm/test/Transforms/SimplifyCFG/duplicate-landingpad.ll llvm/test/Transforms/SimplifyCFG/implied-and-or.ll llvm/test/Transforms/SimplifyCFG/invoke.ll llvm/test/Transforms/SimplifyCFG/merge-cond-stores-2.ll llvm/test/Transforms/SimplifyCFG/phi-undef-loadstore.ll llvm/test/Transforms/SimplifyCFG/pr46638.ll llvm/test/Transforms/SimplifyCFG/preserve-store-alignment.ll llvm/test/Transforms/SimplifyCFG/speculate-vector-ops.ll llvm/test/Transforms/SimplifyCFG/switch-to-br.ll llvm/test/Transforms/SimplifyCFG/unprofitable-pr.ll llvm/unittests/Transforms/Utils/LocalTest.cpp Removed: ################################################################################ diff --git a/llvm/include/llvm/Transforms/Utils/Local.h b/llvm/include/llvm/Transforms/Utils/Local.h index 5a5fb90be1c7..7acf53df4304 100644 --- a/llvm/include/llvm/Transforms/Utils/Local.h +++ b/llvm/include/llvm/Transforms/Utils/Local.h @@ -189,6 +189,7 @@ bool EliminateDuplicatePHINodes(BasicBlock *BB); /// providing the set of loop headers that SimplifyCFG should not eliminate. extern cl::opt<bool> RequireAndPreserveDomTree; bool simplifyCFG(BasicBlock *BB, const TargetTransformInfo &TTI, + DomTreeUpdater *DTU = nullptr, const SimplifyCFGOptions &Options = {}, SmallPtrSetImpl<BasicBlock *> *LoopHeaders = nullptr); diff --git a/llvm/lib/Target/AMDGPU/AMDGPUUnifyDivergentExitNodes.cpp b/llvm/lib/Target/AMDGPU/AMDGPUUnifyDivergentExitNodes.cpp index c0f96e25fc23..2232af66e0da 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUUnifyDivergentExitNodes.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUUnifyDivergentExitNodes.cpp @@ -188,7 +188,8 @@ static BasicBlock *unifyReturnBlockSet(Function &F, for (BasicBlock *BB : ReturningBlocks) { // Cleanup possible branch to unconditional branch to the return. - simplifyCFG(BB, TTI, SimplifyCFGOptions().bonusInstThreshold(2)); + simplifyCFG(BB, TTI, /*DTU=*/nullptr, + SimplifyCFGOptions().bonusInstThreshold(2)); } return NewRetBlock; diff --git a/llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp b/llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp index 9444df8039ad..aecc681aad8e 100644 --- a/llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp +++ b/llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp @@ -168,6 +168,7 @@ static bool mergeEmptyReturnBlocks(Function &F) { /// Call SimplifyCFG on all the blocks in the function, /// iterating until no more changes are made. static bool iterativelySimplifyCFG(Function &F, const TargetTransformInfo &TTI, + DomTreeUpdater *DTU, const SimplifyCFGOptions &Options) { bool Changed = false; bool LocalChange = true; @@ -183,7 +184,7 @@ static bool iterativelySimplifyCFG(Function &F, const TargetTransformInfo &TTI, // Loop over all of the basic blocks and remove them if they are unneeded. for (Function::iterator BBIt = F.begin(); BBIt != F.end(); ) { - if (simplifyCFG(&*BBIt++, TTI, Options, &LoopHeaders)) { + if (simplifyCFG(&*BBIt++, TTI, DTU, Options, &LoopHeaders)) { LocalChange = true; ++NumSimpl; } @@ -200,7 +201,7 @@ static bool simplifyFunctionCFGImpl(Function &F, const TargetTransformInfo &TTI, bool EverChanged = removeUnreachableBlocks(F, DT ? &DTU : nullptr); EverChanged |= mergeEmptyReturnBlocks(F); - EverChanged |= iterativelySimplifyCFG(F, TTI, Options); + EverChanged |= iterativelySimplifyCFG(F, TTI, DT ? &DTU : nullptr, Options); // If neither pass changed anything, we're done. if (!EverChanged) return false; @@ -214,7 +215,7 @@ static bool simplifyFunctionCFGImpl(Function &F, const TargetTransformInfo &TTI, return true; do { - EverChanged = iterativelySimplifyCFG(F, TTI, Options); + EverChanged = iterativelySimplifyCFG(F, TTI, DT ? &DTU : nullptr, Options); EverChanged |= removeUnreachableBlocks(F, DT ? &DTU : nullptr); } while (EverChanged); diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp index 9e9d22c2659c..d32520ec2035 100644 --- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp @@ -214,6 +214,7 @@ struct ValueEqualityComparisonCase { class SimplifyCFGOpt { const TargetTransformInfo &TTI; + DomTreeUpdater *DTU; const DataLayout &DL; SmallPtrSetImpl<BasicBlock *> *LoopHeaders; const SimplifyCFGOptions &Options; @@ -257,10 +258,11 @@ class SimplifyCFGOpt { bool TurnSwitchRangeIntoICmp(SwitchInst *SI, IRBuilder<> &Builder); public: - SimplifyCFGOpt(const TargetTransformInfo &TTI, const DataLayout &DL, + SimplifyCFGOpt(const TargetTransformInfo &TTI, DomTreeUpdater *DTU, + const DataLayout &DL, SmallPtrSetImpl<BasicBlock *> *LoopHeaders, const SimplifyCFGOptions &Opts) - : TTI(TTI), DL(DL), LoopHeaders(LoopHeaders), Options(Opts) {} + : TTI(TTI), DTU(DTU), DL(DL), LoopHeaders(LoopHeaders), Options(Opts) {} bool run(BasicBlock *BB); bool simplifyOnce(BasicBlock *BB); @@ -6326,7 +6328,7 @@ bool SimplifyCFGOpt::simplifyOnce(BasicBlock *BB) { // Merge basic blocks into their predecessor if there is only one distinct // pred, and if there is only one distinct successor of the predecessor, and // if there are no PHI nodes. - if (MergeBlockIntoPredecessor(BB)) + if (MergeBlockIntoPredecessor(BB, DTU)) return true; if (SinkCommon && Options.SinkCommonInsts) @@ -6387,9 +6389,9 @@ bool SimplifyCFGOpt::run(BasicBlock *BB) { } bool llvm::simplifyCFG(BasicBlock *BB, const TargetTransformInfo &TTI, - const SimplifyCFGOptions &Options, + DomTreeUpdater *DTU, const SimplifyCFGOptions &Options, SmallPtrSetImpl<BasicBlock *> *LoopHeaders) { - return SimplifyCFGOpt(TTI, BB->getModule()->getDataLayout(), LoopHeaders, + return SimplifyCFGOpt(TTI, DTU, BB->getModule()->getDataLayout(), LoopHeaders, Options) .run(BB); } diff --git a/llvm/test/Transforms/ADCE/basictest.ll b/llvm/test/Transforms/ADCE/basictest.ll index aaacc1842253..77072dffa923 100644 --- a/llvm/test/Transforms/ADCE/basictest.ll +++ b/llvm/test/Transforms/ADCE/basictest.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -adce -simplifycfg | llvm-dis +; RUN: opt < %s -adce -simplifycfg -simplifycfg-require-and-preserve-domtree=1 | llvm-dis ; RUN: opt < %s -passes=adce | llvm-dis define i32 @Test(i32 %A, i32 %B) { diff --git a/llvm/test/Transforms/ADCE/unreachable.ll b/llvm/test/Transforms/ADCE/unreachable.ll index aaacc1842253..77072dffa923 100644 --- a/llvm/test/Transforms/ADCE/unreachable.ll +++ b/llvm/test/Transforms/ADCE/unreachable.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -adce -simplifycfg | llvm-dis +; RUN: opt < %s -adce -simplifycfg -simplifycfg-require-and-preserve-domtree=1 | llvm-dis ; RUN: opt < %s -passes=adce | llvm-dis define i32 @Test(i32 %A, i32 %B) { diff --git a/llvm/test/Transforms/GlobalDCE/deadblockaddr.ll b/llvm/test/Transforms/GlobalDCE/deadblockaddr.ll index 1ec5994d0043..2aea5f1cf8d0 100644 --- a/llvm/test/Transforms/GlobalDCE/deadblockaddr.ll +++ b/llvm/test/Transforms/GlobalDCE/deadblockaddr.ll @@ -1,4 +1,4 @@ -; RUN: opt -globaldce -simplifycfg -S < %s | FileCheck %s +; RUN: opt -globaldce -simplifycfg -simplifycfg-require-and-preserve-domtree=1 -S < %s | FileCheck %s ; Tests whether globaldce does the right cleanup while removing @bar ; so that a dead BlockAddress reference to foo won't prevent other passes diff --git a/llvm/test/Transforms/IndVarSimplify/exit_value_tests.ll b/llvm/test/Transforms/IndVarSimplify/exit_value_tests.ll index f06164e4a1e5..6dc8ede1de36 100644 --- a/llvm/test/Transforms/IndVarSimplify/exit_value_tests.ll +++ b/llvm/test/Transforms/IndVarSimplify/exit_value_tests.ll @@ -1,5 +1,5 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py -; RUN: opt < %s -indvars -loop-deletion -simplifycfg -S | FileCheck %s +; RUN: opt < %s -indvars -loop-deletion -simplifycfg -simplifycfg-require-and-preserve-domtree=1 -S | FileCheck %s ; Test that we can evaluate the exit values of various expression types. Since ; these loops all have predictable exit values we can replace the use outside diff --git a/llvm/test/Transforms/InstCombine/2003-08-12-AllocaNonNull.ll b/llvm/test/Transforms/InstCombine/2003-08-12-AllocaNonNull.ll index 50b9fdb16458..027299ff2540 100644 --- a/llvm/test/Transforms/InstCombine/2003-08-12-AllocaNonNull.ll +++ b/llvm/test/Transforms/InstCombine/2003-08-12-AllocaNonNull.ll @@ -1,6 +1,6 @@ ; This testcase can be simplified by "realizing" that alloca can never return ; null. -; RUN: opt < %s -instcombine -simplifycfg -S | FileCheck %s +; RUN: opt < %s -instcombine -simplifycfg -simplifycfg-require-and-preserve-domtree=1 -S | FileCheck %s ; CHECK-NOT: br declare i32 @bitmap_clear(...) diff --git a/llvm/test/Transforms/InstCombine/2009-01-19-fmod-constant-float-specials.ll b/llvm/test/Transforms/InstCombine/2009-01-19-fmod-constant-float-specials.ll index b9aa0a254972..660cba57f5e7 100644 --- a/llvm/test/Transforms/InstCombine/2009-01-19-fmod-constant-float-specials.ll +++ b/llvm/test/Transforms/InstCombine/2009-01-19-fmod-constant-float-specials.ll @@ -1,6 +1,6 @@ -; RUN: opt < %s -simplifycfg -instcombine -S | grep 0x7FF8000000000000 | count 12 -; RUN: opt < %s -simplifycfg -instcombine -S | grep "0\.0" | count 3 -; RUN: opt < %s -simplifycfg -instcombine -S | grep "3\.5" | count 1 +; RUN: opt < %s -simplifycfg -simplifycfg-require-and-preserve-domtree=1 -instcombine -S | grep 0x7FF8000000000000 | count 12 +; RUN: opt < %s -simplifycfg -simplifycfg-require-and-preserve-domtree=1 -instcombine -S | grep "0\.0" | count 3 +; RUN: opt < %s -simplifycfg -simplifycfg-require-and-preserve-domtree=1 -instcombine -S | grep "3\.5" | count 1 ; ; ModuleID = 'apf.c' diff --git a/llvm/test/Transforms/InstCombine/2009-01-19-fmod-constant-float.ll b/llvm/test/Transforms/InstCombine/2009-01-19-fmod-constant-float.ll index 5adcb6bfa071..58f84f43374a 100644 --- a/llvm/test/Transforms/InstCombine/2009-01-19-fmod-constant-float.ll +++ b/llvm/test/Transforms/InstCombine/2009-01-19-fmod-constant-float.ll @@ -1,5 +1,5 @@ -; RUN: opt < %s -simplifycfg -instcombine -S | grep 0x3FB99999A0000000 | count 2 -; RUN: opt < %s -simplifycfg -instcombine -S | grep 0xBFB99999A0000000 | count 2 +; RUN: opt < %s -simplifycfg -simplifycfg-require-and-preserve-domtree=1 -instcombine -S | grep 0x3FB99999A0000000 | count 2 +; RUN: opt < %s -simplifycfg -simplifycfg-require-and-preserve-domtree=1 -instcombine -S | grep 0xBFB99999A0000000 | count 2 ; check constant folding for 'frem'. PR 3316. ; ModuleID = 'tt.c' diff --git a/llvm/test/Transforms/InstCombine/bittest.ll b/llvm/test/Transforms/InstCombine/bittest.ll index edf65d5a87ba..5b8ec120c304 100644 --- a/llvm/test/Transforms/InstCombine/bittest.ll +++ b/llvm/test/Transforms/InstCombine/bittest.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -instcombine -simplifycfg -S |\ +; RUN: opt < %s -instcombine -simplifycfg -simplifycfg-require-and-preserve-domtree=1 -S |\ ; RUN: not grep "call void @abort" @b_rec.0 = external global i32 ; <i32*> [#uses=2] diff --git a/llvm/test/Transforms/JumpThreading/no-irreducible-loops.ll b/llvm/test/Transforms/JumpThreading/no-irreducible-loops.ll index c6e9faa17116..7470ddebd0c2 100644 --- a/llvm/test/Transforms/JumpThreading/no-irreducible-loops.ll +++ b/llvm/test/Transforms/JumpThreading/no-irreducible-loops.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -jump-threading -loop-rotate -instcombine -indvars -loop-unroll -simplifycfg -S -verify-dom-info -verify-loop-info > %t +; RUN: opt < %s -jump-threading -loop-rotate -instcombine -indvars -loop-unroll -simplifycfg -simplifycfg-require-and-preserve-domtree=1 -S -verify-dom-info -verify-loop-info > %t ; RUN: grep "store volatile" %t | count 3 ; RUN: not grep "br label" %t diff --git a/llvm/test/Transforms/LICM/2003-02-27-PreheaderProblem.ll b/llvm/test/Transforms/LICM/2003-02-27-PreheaderProblem.ll index b54d520a91f7..a18f3e37d8c3 100644 --- a/llvm/test/Transforms/LICM/2003-02-27-PreheaderProblem.ll +++ b/llvm/test/Transforms/LICM/2003-02-27-PreheaderProblem.ll @@ -1,9 +1,9 @@ -; Here we have a case where there are two loops and LICM is hoisting an -; instruction from one loop into the other loop! This is obviously bad and +; Here we have a case where there are two loops and LICM is hoisting an +; instruction from one loop into the other loop! This is obviously bad and ; happens because preheader insertion doesn't insert a preheader for this ; case... bad. -; RUN: opt < %s -licm -loop-deletion -simplifycfg -S | \ +; RUN: opt < %s -licm -loop-deletion -simplifycfg -simplifycfg-require-and-preserve-domtree=1 -S | \ ; RUN: not grep "br " define i32 @main(i32 %argc) { diff --git a/llvm/test/Transforms/LoopInterchange/interchange-no-deps.ll b/llvm/test/Transforms/LoopInterchange/interchange-no-deps.ll index 5423648ce140..f8e2d6b45a19 100644 --- a/llvm/test/Transforms/LoopInterchange/interchange-no-deps.ll +++ b/llvm/test/Transforms/LoopInterchange/interchange-no-deps.ll @@ -1,5 +1,5 @@ ; REQUIRES: asserts -; RUN: opt < %s -loop-interchange -simplifycfg -pass-remarks-output=%t \ +; RUN: opt < %s -loop-interchange -simplifycfg -simplifycfg-require-and-preserve-domtree=1 -pass-remarks-output=%t \ ; RUN: -pass-remarks=loop-interchange -pass-remarks-missed=loop-interchange -stats -S 2>&1 \ ; RUN: | FileCheck -check-prefix=STATS %s ; RUN: FileCheck -input-file %t %s diff --git a/llvm/test/Transforms/LoopSimplify/2003-08-15-PreheadersFail.ll b/llvm/test/Transforms/LoopSimplify/2003-08-15-PreheadersFail.ll index 4a69067f5f18..0be7581e4962 100644 --- a/llvm/test/Transforms/LoopSimplify/2003-08-15-PreheadersFail.ll +++ b/llvm/test/Transforms/LoopSimplify/2003-08-15-PreheadersFail.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -instcombine -simplifycfg -licm -disable-output +; RUN: opt < %s -instcombine -simplifycfg -simplifycfg-require-and-preserve-domtree=1 -licm -disable-output target datalayout = "e-p:32:32" @yy_base = external global [787 x i16] ; <[787 x i16]*> [#uses=1] @yy_state_ptr = external global i32* ; <i32**> [#uses=3] diff --git a/llvm/test/Transforms/LoopVectorize/AArch64/aarch64-predication.ll b/llvm/test/Transforms/LoopVectorize/AArch64/aarch64-predication.ll index eb12803a3447..ae5b0aaed0cd 100644 --- a/llvm/test/Transforms/LoopVectorize/AArch64/aarch64-predication.ll +++ b/llvm/test/Transforms/LoopVectorize/AArch64/aarch64-predication.ll @@ -1,6 +1,6 @@ ; REQUIRES: asserts ; RUN: opt < %s -loop-vectorize -disable-output -debug-only=loop-vectorize 2>&1 | FileCheck %s --check-prefix=COST -; RUN: opt < %s -loop-vectorize -force-vector-width=2 -instcombine -simplifycfg -S | FileCheck %s +; RUN: opt < %s -loop-vectorize -force-vector-width=2 -instcombine -simplifycfg -simplifycfg-require-and-preserve-domtree=1 -S | FileCheck %s target datalayout = "e-m:e-i64:64-i128:128-n32:64-S128" target triple = "aarch64--linux-gnu" diff --git a/llvm/test/Transforms/LoopVectorize/PowerPC/widened-massv-vfabi-attr.ll b/llvm/test/Transforms/LoopVectorize/PowerPC/widened-massv-vfabi-attr.ll index 91ab38c5cdc0..a6ea7329ee80 100644 --- a/llvm/test/Transforms/LoopVectorize/PowerPC/widened-massv-vfabi-attr.ll +++ b/llvm/test/Transforms/LoopVectorize/PowerPC/widened-massv-vfabi-attr.ll @@ -1,7 +1,7 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py ; RUN: opt -vectorizer-maximize-bandwidth -mtriple=powerpc64le-- -S \ ; RUN: -targetlibinfo -loop-simplify -loop-rotate -loop-vectorize \ -; RUN: -instcombine -simplifycfg -force-vector-interleave=1 < %s | FileCheck %s +; RUN: -instcombine -simplifycfg -simplifycfg-require-and-preserve-domtree=1 -force-vector-interleave=1 < %s | FileCheck %s define dso_local double @test(float* %Arr) { ; CHECK-LABEL: @test( ; CHECK-NEXT: entry: diff --git a/llvm/test/Transforms/LoopVectorize/X86/pr42674.ll b/llvm/test/Transforms/LoopVectorize/X86/pr42674.ll index f9a469cd093e..8252ef7e2cf7 100644 --- a/llvm/test/Transforms/LoopVectorize/X86/pr42674.ll +++ b/llvm/test/Transforms/LoopVectorize/X86/pr42674.ll @@ -1,5 +1,5 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py -; RUN: opt %s -loop-vectorize -instcombine -simplifycfg -mtriple=x86_64-unknown-linux-gnu -mattr=avx512vl,avx512dq,avx512bw -S | FileCheck %s +; RUN: opt %s -loop-vectorize -instcombine -simplifycfg -simplifycfg-require-and-preserve-domtree=1 -mtriple=x86_64-unknown-linux-gnu -mattr=avx512vl,avx512dq,avx512bw -S | FileCheck %s @bytes = global [128 x i8] zeroinitializer, align 16 diff --git a/llvm/test/Transforms/SCCP/2003-06-24-OverdefinedPHIValue.ll b/llvm/test/Transforms/SCCP/2003-06-24-OverdefinedPHIValue.ll index e5a1d679fc29..760f460c3bb5 100644 --- a/llvm/test/Transforms/SCCP/2003-06-24-OverdefinedPHIValue.ll +++ b/llvm/test/Transforms/SCCP/2003-06-24-OverdefinedPHIValue.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -sccp -simplifycfg -S | \ +; RUN: opt < %s -sccp -simplifycfg -simplifycfg-require-and-preserve-domtree=1 -S | \ ; RUN: not grep then: define void @cprop_test11(i32* %data.1) { diff --git a/llvm/test/Transforms/SCCP/calltest.ll b/llvm/test/Transforms/SCCP/calltest.ll index a6c2606cb198..c1c270431198 100644 --- a/llvm/test/Transforms/SCCP/calltest.ll +++ b/llvm/test/Transforms/SCCP/calltest.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -sccp -loop-deletion -simplifycfg -S | FileCheck %s +; RUN: opt < %s -sccp -loop-deletion -simplifycfg -simplifycfg-require-and-preserve-domtree=1 -S | FileCheck %s declare double @sqrt(double) readnone nounwind %empty = type {} diff --git a/llvm/test/Transforms/SimplifyCFG/2002-05-21-PHIElimination.ll b/llvm/test/Transforms/SimplifyCFG/2002-05-21-PHIElimination.ll index 055386b34751..e0cb6d09f2bb 100644 --- a/llvm/test/Transforms/SimplifyCFG/2002-05-21-PHIElimination.ll +++ b/llvm/test/Transforms/SimplifyCFG/2002-05-21-PHIElimination.ll @@ -4,7 +4,7 @@ ; ; Which is not valid SSA ; -; RUN: opt < %s -simplifycfg | llvm-dis +; RUN: opt < %s -simplifycfg -simplifycfg-require-and-preserve-domtree=1 | llvm-dis define void @test() { ; <label>:0 diff --git a/llvm/test/Transforms/SimplifyCFG/2003-03-07-DominateProblem.ll b/llvm/test/Transforms/SimplifyCFG/2003-03-07-DominateProblem.ll index 876204619941..544f391f776c 100644 --- a/llvm/test/Transforms/SimplifyCFG/2003-03-07-DominateProblem.ll +++ b/llvm/test/Transforms/SimplifyCFG/2003-03-07-DominateProblem.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -simplifycfg -disable-output +; RUN: opt < %s -simplifycfg -simplifycfg-require-and-preserve-domtree=1 -disable-output define void @test(i32* %ldo, i1 %c, i1 %d) { bb9: diff --git a/llvm/test/Transforms/SimplifyCFG/2005-08-01-PHIUpdateFail.ll b/llvm/test/Transforms/SimplifyCFG/2005-08-01-PHIUpdateFail.ll index c45986749ab0..da7d0808cf86 100644 --- a/llvm/test/Transforms/SimplifyCFG/2005-08-01-PHIUpdateFail.ll +++ b/llvm/test/Transforms/SimplifyCFG/2005-08-01-PHIUpdateFail.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -simplifycfg -disable-output +; RUN: opt < %s -simplifycfg -simplifycfg-require-and-preserve-domtree=1 -disable-output ; END. define void @main() { diff --git a/llvm/test/Transforms/SimplifyCFG/2006-02-17-InfiniteUnroll.ll b/llvm/test/Transforms/SimplifyCFG/2006-02-17-InfiniteUnroll.ll index 32f49e667883..c1a5f5eeb02a 100644 --- a/llvm/test/Transforms/SimplifyCFG/2006-02-17-InfiniteUnroll.ll +++ b/llvm/test/Transforms/SimplifyCFG/2006-02-17-InfiniteUnroll.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -simplifycfg -disable-output +; RUN: opt < %s -simplifycfg -simplifycfg-require-and-preserve-domtree=1 -disable-output define void @polnel_() { entry: diff --git a/llvm/test/Transforms/SimplifyCFG/2007-11-22-InvokeNoUnwind.ll b/llvm/test/Transforms/SimplifyCFG/2007-11-22-InvokeNoUnwind.ll index c38d71ccd284..77d736f33825 100644 --- a/llvm/test/Transforms/SimplifyCFG/2007-11-22-InvokeNoUnwind.ll +++ b/llvm/test/Transforms/SimplifyCFG/2007-11-22-InvokeNoUnwind.ll @@ -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 diff --git a/llvm/test/Transforms/SimplifyCFG/2008-05-16-PHIBlockMerge.ll b/llvm/test/Transforms/SimplifyCFG/2008-05-16-PHIBlockMerge.ll index 161e74c6e098..5ee01136d33b 100644 --- a/llvm/test/Transforms/SimplifyCFG/2008-05-16-PHIBlockMerge.ll +++ b/llvm/test/Transforms/SimplifyCFG/2008-05-16-PHIBlockMerge.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -simplifycfg -S > %t +; RUN: opt < %s -simplifycfg -simplifycfg-require-and-preserve-domtree=1 -S > %t ; RUN: not grep "^BB.tomerge" %t ; RUN: grep "^BB.nomerge" %t | count 4 diff --git a/llvm/test/Transforms/SimplifyCFG/PHINode.ll b/llvm/test/Transforms/SimplifyCFG/PHINode.ll index a024c9d41dba..8270ab78fd11 100644 --- a/llvm/test/Transforms/SimplifyCFG/PHINode.ll +++ b/llvm/test/Transforms/SimplifyCFG/PHINode.ll @@ -1,7 +1,7 @@ -; -simplifycfg is not folding blocks if there is a PHI node involved. This +; -simplifycfg -simplifycfg-require-and-preserve-domtree=1 is not folding blocks if there is a PHI node involved. This ; should be fixed eventually -; RUN: opt < %s -simplifycfg -S | FileCheck %s +; RUN: opt < %s -simplifycfg -simplifycfg-require-and-preserve-domtree=1 -S | FileCheck %s define i32 @main(i32 %argc) { ; <label>:0 diff --git a/llvm/test/Transforms/SimplifyCFG/PhiEliminate3.ll b/llvm/test/Transforms/SimplifyCFG/PhiEliminate3.ll index 9bcac880f0f6..cf956e084ce9 100644 --- a/llvm/test/Transforms/SimplifyCFG/PhiEliminate3.ll +++ b/llvm/test/Transforms/SimplifyCFG/PhiEliminate3.ll @@ -1,7 +1,7 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py -; RUN: opt < %s -simplifycfg -S -phi-node-folding-threshold=1 | FileCheck %s -; RUN: opt < %s -simplifycfg -S -phi-node-folding-threshold=2 | FileCheck %s -; RUN: opt < %s -simplifycfg -S -phi-node-folding-threshold=7 | FileCheck %s +; RUN: opt < %s -simplifycfg -simplifycfg-require-and-preserve-domtree=1 -S -phi-node-folding-threshold=1 | FileCheck %s +; RUN: opt < %s -simplifycfg -simplifycfg-require-and-preserve-domtree=1 -S -phi-node-folding-threshold=2 | FileCheck %s +; RUN: opt < %s -simplifycfg -simplifycfg-require-and-preserve-domtree=1 -S -phi-node-folding-threshold=7 | FileCheck %s ; Test merging of blocks containing complex expressions, ; with various folding thresholds diff --git a/llvm/test/Transforms/SimplifyCFG/X86/merge-cleanuppads.ll b/llvm/test/Transforms/SimplifyCFG/X86/merge-cleanuppads.ll index 94ef8d71d5cc..44780ac6bd55 100644 --- a/llvm/test/Transforms/SimplifyCFG/X86/merge-cleanuppads.ll +++ b/llvm/test/Transforms/SimplifyCFG/X86/merge-cleanuppads.ll @@ -1,4 +1,4 @@ -; RUN: opt -S -simplifycfg < %s | FileCheck %s +; RUN: opt -S -simplifycfg -simplifycfg-require-and-preserve-domtree=1 < %s | FileCheck %s target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-windows-msvc18.0.0" diff --git a/llvm/test/Transforms/SimplifyCFG/X86/unreachable-blocks.ll b/llvm/test/Transforms/SimplifyCFG/X86/unreachable-blocks.ll index 87a64ad47c62..29b7d7c7c217 100644 --- a/llvm/test/Transforms/SimplifyCFG/X86/unreachable-blocks.ll +++ b/llvm/test/Transforms/SimplifyCFG/X86/unreachable-blocks.ll @@ -1,4 +1,4 @@ -; RUN: opt -simplifycfg < %s -disable-output +; RUN: opt -simplifycfg -simplifycfg-require-and-preserve-domtree=1 < %s -disable-output 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-pc-linux-gnu" diff --git a/llvm/test/Transforms/SimplifyCFG/branch-fold-test.ll b/llvm/test/Transforms/SimplifyCFG/branch-fold-test.ll index 460f2456d8ce..efb0ca6d8b72 100644 --- a/llvm/test/Transforms/SimplifyCFG/branch-fold-test.ll +++ b/llvm/test/Transforms/SimplifyCFG/branch-fold-test.ll @@ -1,7 +1,7 @@ ; This test ensures that the simplifycfg pass continues to constant fold ; terminator instructions. -; RUN: opt < %s -simplifycfg -S | not grep br +; RUN: opt < %s -simplifycfg -simplifycfg-require-and-preserve-domtree=1 -S | not grep br define i32 @test(i32 %A, i32 %B) { J: diff --git a/llvm/test/Transforms/SimplifyCFG/branch-phi-thread.ll b/llvm/test/Transforms/SimplifyCFG/branch-phi-thread.ll index 4c1b7e68e25f..366c2fb44b8c 100644 --- a/llvm/test/Transforms/SimplifyCFG/branch-phi-thread.ll +++ b/llvm/test/Transforms/SimplifyCFG/branch-phi-thread.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -simplifycfg -adce -S | \ +; RUN: opt < %s -simplifycfg -simplifycfg-require-and-preserve-domtree=1 -adce -S | \ ; RUN: not grep "call void @f1" ; END. diff --git a/llvm/test/Transforms/SimplifyCFG/dbginfo.ll b/llvm/test/Transforms/SimplifyCFG/dbginfo.ll index 12aec91c6c55..6077151a6187 100644 --- a/llvm/test/Transforms/SimplifyCFG/dbginfo.ll +++ b/llvm/test/Transforms/SimplifyCFG/dbginfo.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -simplifycfg -S | not grep "br label" +; RUN: opt < %s -simplifycfg -simplifycfg-require-and-preserve-domtree=1 -S | not grep "br label" %llvm.dbg.anchor.type = type { i32, i32 } %llvm.dbg.basictype.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, i32 } diff --git a/llvm/test/Transforms/SimplifyCFG/dce-cond-after-folding-terminator.ll b/llvm/test/Transforms/SimplifyCFG/dce-cond-after-folding-terminator.ll index 9c414b488373..923caabdb2a0 100644 --- a/llvm/test/Transforms/SimplifyCFG/dce-cond-after-folding-terminator.ll +++ b/llvm/test/Transforms/SimplifyCFG/dce-cond-after-folding-terminator.ll @@ -1,4 +1,4 @@ -; RUN: opt -S <%s -simplifycfg | FileCheck %s +; RUN: opt -S <%s -simplifycfg -simplifycfg-require-and-preserve-domtree=1 | FileCheck %s define void @test_br(i32 %x) { entry: diff --git a/llvm/test/Transforms/SimplifyCFG/debug-info-thread-phi.ll b/llvm/test/Transforms/SimplifyCFG/debug-info-thread-phi.ll index c5eb43642bf8..83a303c30fd9 100644 --- a/llvm/test/Transforms/SimplifyCFG/debug-info-thread-phi.ll +++ b/llvm/test/Transforms/SimplifyCFG/debug-info-thread-phi.ll @@ -1,4 +1,4 @@ -; RUN: opt %s -debugify -simplifycfg -S | FileCheck %s +; RUN: opt %s -debugify -simplifycfg -simplifycfg-require-and-preserve-domtree=1 -S | FileCheck %s ; Tests Bug 37966 define void @bar(i32 %aa) { diff --git a/llvm/test/Transforms/SimplifyCFG/duplicate-landingpad.ll b/llvm/test/Transforms/SimplifyCFG/duplicate-landingpad.ll index 6f8b069810f8..a38f0ae6275c 100644 --- a/llvm/test/Transforms/SimplifyCFG/duplicate-landingpad.ll +++ b/llvm/test/Transforms/SimplifyCFG/duplicate-landingpad.ll @@ -1,5 +1,5 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py -; RUN: opt < %s -simplifycfg -S | FileCheck %s +; RUN: opt < %s -simplifycfg -simplifycfg-require-and-preserve-domtree=1 -S | FileCheck %s 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-S128" declare i32 @__gxx_personality_v0(...) diff --git a/llvm/test/Transforms/SimplifyCFG/implied-and-or.ll b/llvm/test/Transforms/SimplifyCFG/implied-and-or.ll index dd885c94bdc9..a7e07b29676c 100644 --- a/llvm/test/Transforms/SimplifyCFG/implied-and-or.ll +++ b/llvm/test/Transforms/SimplifyCFG/implied-and-or.ll @@ -1,5 +1,5 @@ ; 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 declare void @foo() declare void @bar() diff --git a/llvm/test/Transforms/SimplifyCFG/invoke.ll b/llvm/test/Transforms/SimplifyCFG/invoke.ll index dcba88e9ab68..5e0d2627b546 100644 --- a/llvm/test/Transforms/SimplifyCFG/invoke.ll +++ b/llvm/test/Transforms/SimplifyCFG/invoke.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -simplifycfg -S | FileCheck %s +; RUN: opt < %s -simplifycfg -simplifycfg-require-and-preserve-domtree=1 -S | FileCheck %s 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-S128" declare i32 @__gxx_personality_v0(...) diff --git a/llvm/test/Transforms/SimplifyCFG/merge-cond-stores-2.ll b/llvm/test/Transforms/SimplifyCFG/merge-cond-stores-2.ll index 300f78987b95..dcb058b3613b 100644 --- a/llvm/test/Transforms/SimplifyCFG/merge-cond-stores-2.ll +++ b/llvm/test/Transforms/SimplifyCFG/merge-cond-stores-2.ll @@ -1,5 +1,5 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py -; RUN: opt -S < %s -simplifycfg -simplifycfg-merge-cond-stores=true -simplifycfg-merge-cond-stores-aggressively=false -phi-node-folding-threshold=1 | FileCheck %s +; RUN: opt -S < %s -simplifycfg -simplifycfg-require-and-preserve-domtree=1 -simplifycfg-merge-cond-stores=true -simplifycfg-merge-cond-stores-aggressively=false -phi-node-folding-threshold=1 | FileCheck %s target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64" target triple = "armv7--linux-gnueabihf" diff --git a/llvm/test/Transforms/SimplifyCFG/phi-undef-loadstore.ll b/llvm/test/Transforms/SimplifyCFG/phi-undef-loadstore.ll index af598721ae00..0f1f74e65cb2 100644 --- a/llvm/test/Transforms/SimplifyCFG/phi-undef-loadstore.ll +++ b/llvm/test/Transforms/SimplifyCFG/phi-undef-loadstore.ll @@ -1,4 +1,4 @@ -; RUN: opt -simplifycfg -S < %s | FileCheck %s +; RUN: opt -simplifycfg -simplifycfg-require-and-preserve-domtree=1 -S < %s | FileCheck %s declare void @bar() nounwind diff --git a/llvm/test/Transforms/SimplifyCFG/pr46638.ll b/llvm/test/Transforms/SimplifyCFG/pr46638.ll index ba7ce88cf6ad..bdc2848239a3 100644 --- a/llvm/test/Transforms/SimplifyCFG/pr46638.ll +++ b/llvm/test/Transforms/SimplifyCFG/pr46638.ll @@ -1,5 +1,5 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py -; RUN: opt -S -simplifycfg < %s | FileCheck %s +; RUN: opt -S -simplifycfg -simplifycfg-require-and-preserve-domtree=1 < %s | FileCheck %s define void @pr46638(i1 %c, i32 %x) { ; CHECK-LABEL: @pr46638( diff --git a/llvm/test/Transforms/SimplifyCFG/preserve-store-alignment.ll b/llvm/test/Transforms/SimplifyCFG/preserve-store-alignment.ll index 7d25ed2c797f..845e29cd62ea 100644 --- a/llvm/test/Transforms/SimplifyCFG/preserve-store-alignment.ll +++ b/llvm/test/Transforms/SimplifyCFG/preserve-store-alignment.ll @@ -1,5 +1,5 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py -; RUN: opt -simplifycfg -S < %s | FileCheck %s +; RUN: opt -simplifycfg -simplifycfg-require-and-preserve-domtree=1 -S < %s | FileCheck %s %struct.Counters = type { i64, i64, i64, [8 x i8] } diff --git a/llvm/test/Transforms/SimplifyCFG/speculate-vector-ops.ll b/llvm/test/Transforms/SimplifyCFG/speculate-vector-ops.ll index 91972eb5dd9f..0cda474e46ab 100644 --- a/llvm/test/Transforms/SimplifyCFG/speculate-vector-ops.ll +++ b/llvm/test/Transforms/SimplifyCFG/speculate-vector-ops.ll @@ -1,4 +1,4 @@ -; RUN: opt -S -simplifycfg < %s | FileCheck %s +; RUN: opt -S -simplifycfg -simplifycfg-require-and-preserve-domtree=1 < %s | FileCheck %s define i32 @speculate_vector_extract(i32 %d, <4 x i32> %v) #0 { ; CHECK-LABEL: @speculate_vector_extract( diff --git a/llvm/test/Transforms/SimplifyCFG/switch-to-br.ll b/llvm/test/Transforms/SimplifyCFG/switch-to-br.ll index 01484cda98b0..6c6287c53b6c 100644 --- a/llvm/test/Transforms/SimplifyCFG/switch-to-br.ll +++ b/llvm/test/Transforms/SimplifyCFG/switch-to-br.ll @@ -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 i32 @f(i32) diff --git a/llvm/test/Transforms/SimplifyCFG/unprofitable-pr.ll b/llvm/test/Transforms/SimplifyCFG/unprofitable-pr.ll index 31ed7e203c45..283922f015ed 100644 --- a/llvm/test/Transforms/SimplifyCFG/unprofitable-pr.ll +++ b/llvm/test/Transforms/SimplifyCFG/unprofitable-pr.ll @@ -1,5 +1,5 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py -; RUN: opt -simplifycfg -simplifycfg-max-small-block-size=10 -S < %s | FileCheck %s +; RUN: opt -simplifycfg -simplifycfg-require-and-preserve-domtree=1 -simplifycfg-max-small-block-size=10 -S < %s | FileCheck %s ; RUN: opt -passes=simplify-cfg -simplifycfg-max-small-block-size=10 -S < %s | FileCheck %s target datalayout = "e-p:64:64-p5:32:32-A5" diff --git a/llvm/unittests/Transforms/Utils/LocalTest.cpp b/llvm/unittests/Transforms/Utils/LocalTest.cpp index 3dec930a2727..ece83950955a 100644 --- a/llvm/unittests/Transforms/Utils/LocalTest.cpp +++ b/llvm/unittests/Transforms/Utils/LocalTest.cpp @@ -999,7 +999,7 @@ TEST(Local, SimplifyCFGWithNullAC) { ASSERT_TRUE(TestBB); // %test.bb is expected to be simplified by FoldCondBranchOnPHI. - EXPECT_TRUE(simplifyCFG(TestBB, TTI, Options)); + EXPECT_TRUE(simplifyCFG(TestBB, TTI, /*DTU=*/nullptr, Options)); } TEST(Local, CanReplaceOperandWithVariable) { _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits