rsmith accepted this revision.
rsmith added a comment.
This revision is now accepted and ready to land.

I think it's generally better to not run cleanups on the way to a `terminate` 
call, not only for code size but also for debuggability. This change seems like 
an improvement to me.



================
Comment at: clang/lib/CodeGen/CGCleanup.cpp:189
+  if (find(InnermostEHScope)->getKind() == EHScope::Terminate)
+    IsEHCleanup = false;
+
----------------
Does the situation where both `IsEHCleanup` and `IsNormalCleanup` end up set to 
`false` work well? (Eg, do we avoid generating cleanup code entirely, even for 
things like conditional cleanups where we might otherwise generate a condition 
variable?) Eg, in a case like this:

```
struct A { A(); ~A() noexcept(false); };
void f(bool b) noexcept { (b ? (void)A() : void()), (b ? (void)A() : void()); }
```
... we currently inject some `i1`s to track whether each `A` is alive, and 
could presumably omit them here.

If this patch isn't enough to handle that, maybe this isn't worth worrying 
about at this level and we can just let the optimizer remove them again?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113620

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to