[PATCH] D155711: [SimplifyCFG] Hoist common instructions on Switch.

DianQK via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 31 07:32:27 PDT 2023


DianQK added inline comments.


================
Comment at: llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1590
+        }
+      }
+
----------------
nikic wrote:
> Unless I'm missing something, I don't think this code is correct in the case where instructions are skipped. E.g. if the block is something like `call @not_willreturn; unreachable` and we skip over the first instruction and then see the unreachable, it would not be correct to ignore this successor. Is there a test for this?
> 
> I think you need to do the removal of unreachable blocks before the main loop, so you only handle the case where there is only `unreachable` in the block, not any other instructions.
I moved this before the main loop to keep it simple. `simplifyUnreachable` and `EarlyCSE` have finished for this.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D155711/new/

https://reviews.llvm.org/D155711



More information about the llvm-commits mailing list