diff --git a/src/intel/compiler/brw_fs_combine_constants.cpp b/src/intel/compiler/brw_fs_combine_constants.cpp index 911c6b684f9..ed5176153da 100644 --- a/src/intel/compiler/brw_fs_combine_constants.cpp +++ b/src/intel/compiler/brw_fs_combine_constants.cpp @@ -1834,6 +1834,16 @@ fs_visitor::opt_combine_constants() } if (rebuild_cfg) { + /* When the CFG is initially built, the instructions are removed from + * the list of instructions stored in fs_visitor -- the same exec_node + * is used for membership in that list and in a block list. So we need + * to pull them back before rebuilding the CFG. + */ + assert(exec_list_length(&instructions) == 0); + foreach_block(block, cfg) { + exec_list_append(&instructions, &block->instructions); + } + delete cfg; cfg = NULL; calculate_cfg(); diff --git a/src/intel/compiler/test_fs_combine_constants.cpp b/src/intel/compiler/test_fs_combine_constants.cpp index 02f2cd0f038..805a78e0b50 100644 --- a/src/intel/compiler/test_fs_combine_constants.cpp +++ b/src/intel/compiler/test_fs_combine_constants.cpp @@ -98,7 +98,7 @@ TEST_F(FSCombineConstantsTest, Simple) ASSERT_EQ(bblock_end(block)->opcode, BRW_OPCODE_SEL); } -TEST_F(FSCombineConstantsTest, DISABLED_DoContainingDo) +TEST_F(FSCombineConstantsTest, DoContainingDo) { fs_builder bld = make_builder(shader);