Skip to content

Verify critical edges only when -sil-verify-all is enabled #36276

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/SILOptimizer/LoopTransforms/ArrayPropertyOpt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,8 @@ class SwiftArrayPropertyOptPass : public SILFunctionTransform {
ArrayPropertiesSpecializer(DT, LA, HoistableLoopNest).run();

// Verify that no illegal critical edges were created.
getFunction()->verifyCriticalEdges();
if (getFunction()->getModule().getOptions().VerifyAll)
getFunction()->verifyCriticalEdges();

// We preserve the dominator tree. Let's invalidate everything
// else.
Expand Down
3 changes: 2 additions & 1 deletion lib/SILOptimizer/Transforms/SILMem2Reg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1032,7 +1032,8 @@ bool MemoryToRegisters::promoteSingleAllocation(AllocStackInst *alloc,
bool MemoryToRegisters::run() {
bool Changed = false;

F.verifyCriticalEdges();
if (F.getModule().getOptions().VerifyAll)
F.verifyCriticalEdges();

// Compute dominator tree node levels for the function.
DomTreeLevelMap DomTreeLevels;
Expand Down
6 changes: 4 additions & 2 deletions lib/SILOptimizer/Transforms/SimplifyCFG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3372,7 +3372,9 @@ bool SimplifyCFG::run() {
if (simplifyBlocks())
removeUnreachableBlocks(Fn);
}
Fn.verifyCriticalEdges();

if (Fn.getModule().getOptions().VerifyAll)
Fn.verifyCriticalEdges();

// Canonicalize switch_enum instructions.
Changed |= canonicalizeSwitchEnums();
Expand Down Expand Up @@ -4139,7 +4141,7 @@ class SplitCriticalEdges : public SILFunctionTransform {
void run() override {
auto &Fn = *getFunction();

if (OnlyNonCondBrEdges)
if (OnlyNonCondBrEdges && Fn.getModule().getOptions().VerifyAll)
Fn.verifyCriticalEdges();

// Split all critical edges from all or non only cond_br terminators.
Expand Down
3 changes: 2 additions & 1 deletion lib/SILOptimizer/Utils/CheckedCastBrJumpThreading.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,8 @@ void CheckedCastBrJumpThreading::optimizeFunction() {
return;

// Second phase: transformation.
Fn->verifyCriticalEdges();
if (Fn->getModule().getOptions().VerifyAll)
Fn->verifyCriticalEdges();

for (Edit *edit : Edits) {
BasicBlockCloner Cloner(edit->CCBBlock);
Expand Down