[DSE] Don't remove nounwind invokes
For non-mem-intrinsic and non-lifetime `CallBase`s, the current `isRemovable` function only checks if the `CallBase` 1. has no uses 2. will return 3. does not throw: https://github.com/llvm/llvm-project/blob/80fb7823367c1d105fcbc8f21b69205a0d68c859/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp#L1017 But we should also exclude invokes even in case they don't throw, because they are terminators and thus cannot be removed. While it doesn't seem to make much sense for `invoke`s to have an `nounwind` target, this kind of code can be generated and is also valid bitcode. Reviewed By: nikic Differential Revision: https://reviews.llvm.org/D128224
Loading
Please sign in to comment