From 046c2b7c4c71cc1926bfacf603f5355aa15fe5c8 Mon Sep 17 00:00:00 2001 From: David Neto Date: Thu, 11 Jun 2020 14:19:07 +0000 Subject: [PATCH] [spirv-reader] remove exclusive_false_head_for Code cleanup Bug: tint:3 Change-Id: I8d1c4e8a486b3c3cccb13e0a265269606278fb97 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/23080 Reviewed-by: dan sinclair --- src/reader/spirv/function.cc | 3 --- src/reader/spirv/function.h | 4 ---- src/reader/spirv/function_cfg_test.cc | 15 --------------- 3 files changed, 22 deletions(-) diff --git a/src/reader/spirv/function.cc b/src/reader/spirv/function.cc index 2763c9a1de..bf9ce5f7c5 100644 --- a/src/reader/spirv/function.cc +++ b/src/reader/spirv/function.cc @@ -1343,9 +1343,6 @@ bool FunctionEmitter::FindIfSelectionInternalHeaders() { false_head_info->false_head_for = construct.get(); if_header_info->false_head = false_head_info; } - if ((!contains_true) && contains_false) { - false_head_info->exclusive_false_head_for = construct.get(); - } if ((true_head_info->header_for_merge != 0) && (true_head_info->header_for_merge != construct->begin_id)) { diff --git a/src/reader/spirv/function.h b/src/reader/spirv/function.h index db753f24d8..30fe2526b9 100644 --- a/src/reader/spirv/function.h +++ b/src/reader/spirv/function.h @@ -149,10 +149,6 @@ struct BlockInfo { /// control reconverges between the "then" and "else" clauses, but before /// the merge block for that selection. const Construct* premerge_head_for = nullptr; - /// The construct for which this block is the false head, and that construct - /// does not have a true head. - /// TODO(dneto): I think we can remove |exclusive_false_head_for| - const Construct* exclusive_false_head_for = nullptr; /// If not null, then this block is an if-selection header, and |true_head| is /// the target of the true branch on the OpBranchConditional. /// In particular, true_head->true_head_for == this diff --git a/src/reader/spirv/function_cfg_test.cc b/src/reader/spirv/function_cfg_test.cc index 4150caecbb..3984f3bde1 100644 --- a/src/reader/spirv/function_cfg_test.cc +++ b/src/reader/spirv/function_cfg_test.cc @@ -6687,7 +6687,6 @@ TEST_F(SpvParserTest, FindIfSelectionInternalHeaders_NoIf) { EXPECT_EQ(bi->false_head_for, nullptr); EXPECT_EQ(bi->premerge_head_for, nullptr); EXPECT_EQ(bi->premerge_head_for, nullptr); - EXPECT_EQ(bi->exclusive_false_head_for, nullptr); } TEST_F(SpvParserTest, FindIfSelectionInternalHeaders_ThenElse) { @@ -6718,7 +6717,6 @@ TEST_F(SpvParserTest, FindIfSelectionInternalHeaders_ThenElse) { EXPECT_EQ(bi20->true_head_for->begin_id, 10u); EXPECT_EQ(bi20->false_head_for, nullptr); EXPECT_EQ(bi20->premerge_head_for, nullptr); - EXPECT_EQ(bi20->exclusive_false_head_for, nullptr); auto* bi30 = fe.GetBlockInfo(30); ASSERT_NE(bi30, nullptr); @@ -6726,7 +6724,6 @@ TEST_F(SpvParserTest, FindIfSelectionInternalHeaders_ThenElse) { ASSERT_NE(bi30->false_head_for, nullptr); EXPECT_EQ(bi30->false_head_for->begin_id, 10u); EXPECT_EQ(bi30->premerge_head_for, nullptr); - EXPECT_EQ(bi30->exclusive_false_head_for, nullptr); } TEST_F(SpvParserTest, FindIfSelectionInternalHeaders_IfOnly) { @@ -6754,7 +6751,6 @@ TEST_F(SpvParserTest, FindIfSelectionInternalHeaders_IfOnly) { EXPECT_EQ(bi30->true_head_for->begin_id, 10u); EXPECT_EQ(bi30->false_head_for, nullptr); EXPECT_EQ(bi30->premerge_head_for, nullptr); - EXPECT_EQ(bi30->exclusive_false_head_for, nullptr); } TEST_F(SpvParserTest, FindIfSelectionInternalHeaders_ElseOnly) { @@ -6782,8 +6778,6 @@ TEST_F(SpvParserTest, FindIfSelectionInternalHeaders_ElseOnly) { ASSERT_NE(bi30->false_head_for, nullptr); EXPECT_EQ(bi30->false_head_for->begin_id, 10u); EXPECT_EQ(bi30->premerge_head_for, nullptr); - ASSERT_NE(bi30->exclusive_false_head_for, nullptr); - EXPECT_EQ(bi30->exclusive_false_head_for->begin_id, 10u); } TEST_F(SpvParserTest, FindIfSelectionInternalHeaders_Regardless) { @@ -6817,14 +6811,12 @@ TEST_F(SpvParserTest, FindIfSelectionInternalHeaders_Regardless) { ASSERT_NE(bi20->false_head_for, nullptr); EXPECT_EQ(bi20->false_head_for->begin_id, 10u); EXPECT_EQ(bi20->premerge_head_for, nullptr); - EXPECT_EQ(bi20->exclusive_false_head_for, nullptr); auto* bi80 = fe.GetBlockInfo(80); ASSERT_NE(bi80, nullptr); EXPECT_EQ(bi80->true_head_for, nullptr); EXPECT_EQ(bi80->false_head_for, nullptr); EXPECT_EQ(bi80->premerge_head_for, nullptr); - EXPECT_EQ(bi80->exclusive_false_head_for, nullptr); } TEST_F(SpvParserTest, FindIfSelectionInternalHeaders_Premerge_Simple) { @@ -6860,7 +6852,6 @@ TEST_F(SpvParserTest, FindIfSelectionInternalHeaders_Premerge_Simple) { EXPECT_EQ(bi80->false_head_for, nullptr); ASSERT_NE(bi80->premerge_head_for, nullptr); EXPECT_EQ(bi80->premerge_head_for->begin_id, 10u); - EXPECT_EQ(bi80->exclusive_false_head_for, nullptr); } TEST_F(SpvParserTest, @@ -6897,7 +6888,6 @@ TEST_F(SpvParserTest, EXPECT_EQ(bi20->true_head_for->begin_id, 10u); EXPECT_EQ(bi20->false_head_for, nullptr); EXPECT_EQ(bi20->premerge_head_for, nullptr); - EXPECT_EQ(bi20->exclusive_false_head_for, nullptr); auto* bi30 = fe.GetBlockInfo(30); ASSERT_NE(bi30, nullptr); @@ -6906,14 +6896,12 @@ TEST_F(SpvParserTest, EXPECT_EQ(bi30->false_head_for->begin_id, 10u); ASSERT_NE(bi30->premerge_head_for, nullptr); EXPECT_EQ(bi30->premerge_head_for->begin_id, 10u); - EXPECT_EQ(bi30->exclusive_false_head_for, nullptr); auto* bi80 = fe.GetBlockInfo(80); ASSERT_NE(bi80, nullptr); EXPECT_EQ(bi80->true_head_for, nullptr); EXPECT_EQ(bi80->false_head_for, nullptr); EXPECT_EQ(bi80->premerge_head_for, nullptr); - EXPECT_EQ(bi80->exclusive_false_head_for, nullptr); } TEST_F(SpvParserTest, @@ -6951,7 +6939,6 @@ TEST_F(SpvParserTest, EXPECT_EQ(bi20->false_head_for, nullptr); ASSERT_NE(bi20->premerge_head_for, nullptr); EXPECT_EQ(bi20->premerge_head_for->begin_id, 10u); - EXPECT_EQ(bi20->exclusive_false_head_for, nullptr); auto* bi30 = fe.GetBlockInfo(30); ASSERT_NE(bi30, nullptr); @@ -6959,14 +6946,12 @@ TEST_F(SpvParserTest, ASSERT_NE(bi30->false_head_for, nullptr); EXPECT_EQ(bi30->false_head_for->begin_id, 10u); EXPECT_EQ(bi30->premerge_head_for, nullptr); - EXPECT_EQ(bi30->exclusive_false_head_for, nullptr); auto* bi80 = fe.GetBlockInfo(80); ASSERT_NE(bi80, nullptr); EXPECT_EQ(bi80->true_head_for, nullptr); EXPECT_EQ(bi80->false_head_for, nullptr); EXPECT_EQ(bi80->premerge_head_for, nullptr); - EXPECT_EQ(bi80->exclusive_false_head_for, nullptr); } TEST_F(SpvParserTest,