Fixing missing early exit from break identification
authorAlan Baker <alanbaker@google.com>
Wed, 17 Jan 2018 19:09:24 +0000 (14:09 -0500)
committerAlan Baker <alanbaker@google.com>
Wed, 17 Jan 2018 19:09:24 +0000 (14:09 -0500)
source/opt/aggressive_dead_code_elim_pass.cpp

index 511a12f87905f0c29840e4844c2f7f8bdfd53e53..2e79fe65c02abc694a7f646ccd585500790c9750 100644 (file)
@@ -241,6 +241,7 @@ void AggressiveDCEPass::AddBreaksAndContinuesToWorklist(
       mergeId, [&loopMerge, this](ir::Instruction* user) {
         // A branch to the merge block can only be a break if it is nested in
         // the current loop
+        if (!user->IsBranch()) return;
         ir::Instruction* branchInst = user;
         while (true) {
           ir::BasicBlock* blk = context()->get_instr_block(branchInst);