[all-commits] [llvm/llvm-project] 27e4af: [DSE] Don't remove nounwind invokes
Heejin Ahn via All-commits
all-commits at lists.llvm.org
Tue Jun 21 11:54:25 PDT 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 27e4afcea71818ef2ceb0be109321b9595a8fba2
https://github.com/llvm/llvm-project/commit/27e4afcea71818ef2ceb0be109321b9595a8fba2
Author: Heejin Ahn <aheejin at gmail.com>
Date: 2022-06-21 (Tue, 21 Jun 2022)
Changed paths:
M llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
A llvm/test/Transforms/DeadStoreElimination/nounwind-invoke.ll
Log Message:
-----------
[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
More information about the All-commits
mailing list