mirror of
https://github.com/KhronosGroup/SPIRV-Tools
synced 2024-11-26 21:30:07 +00:00
Address review comments from https://github.com/KhronosGroup/SPIRV-Tools/pull/985.
This commit is contained in:
parent
7834beea80
commit
5b52626eaa
@ -381,7 +381,12 @@ bool AggressiveDCEPass::AggressiveDCE(ir::Function* func) {
|
||||
for (auto bi = structuredOrder.begin(); bi != structuredOrder.end(); ++bi) {
|
||||
for (auto ii = (*bi)->begin(); ii != (*bi)->end(); ++ii) {
|
||||
if (IsLive(&*ii)) continue;
|
||||
if (ii->IsBranch() &&
|
||||
// TODO(greg-lunarg
|
||||
// https://github.com/KhronosGroup/SPIRV-Tools/issues/1021) This should be
|
||||
// using ii->IsBranch(), but this code does not handle OpSwitch
|
||||
// instructions yet.
|
||||
if ((ii->opcode() == SpvOpBranch ||
|
||||
ii->opcode() == SpvOpBranchConditional) &&
|
||||
!IsStructuredIfOrLoopHeader(*bi, nullptr, nullptr, nullptr))
|
||||
continue;
|
||||
dead_insts_.insert(&*ii);
|
||||
|
@ -30,8 +30,10 @@ namespace opt {
|
||||
|
||||
// Represents a CFG control edge.
|
||||
struct Edge {
|
||||
explicit Edge(ir::BasicBlock* b1, ir::BasicBlock* b2)
|
||||
: source(b1), dest(b2) {}
|
||||
Edge(ir::BasicBlock* b1, ir::BasicBlock* b2) : source(b1), dest(b2) {
|
||||
assert(source && "CFG edges cannot have a null source block.");
|
||||
assert(dest && "CFG edges cannot have a null destination block.");
|
||||
}
|
||||
ir::BasicBlock* source;
|
||||
ir::BasicBlock* dest;
|
||||
bool operator<(const Edge& o) const {
|
||||
|
Loading…
Reference in New Issue
Block a user