Coverage Report

Created: 2025-11-16 06:14

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/spirv-tools/source/opt/cfg_cleanup_pass.cpp
Line
Count
Source
1
// Copyright (c) 2017 Google Inc.
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
//     http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14
15
// This file implements a pass to cleanup the CFG to remove superfluous
16
// constructs (e.g., unreachable basic blocks, empty control flow structures,
17
// etc)
18
19
#include "source/opt/cfg_cleanup_pass.h"
20
21
#include "source/opt/function.h"
22
23
namespace spvtools {
24
namespace opt {
25
26
6.21k
Pass::Status CFGCleanupPass::Process() {
27
  // Process all entry point functions.
28
6.21k
  ProcessFunction pfn = [this](Function* fp) { return CFGCleanup(fp); };
29
6.21k
  bool modified = context()->ProcessReachableCallTree(pfn);
30
6.21k
  return modified ? Pass::Status::SuccessWithChange
31
6.21k
                  : Pass::Status::SuccessWithoutChange;
32
6.21k
}
33
34
}  // namespace opt
35
}  // namespace spvtools