[PATCH] D74651: Add IR constructs for inalloca replacement preallocated call setup

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 29 13:28:39 PDT 2020


rnk added a comment.

I see, the noreturn part of this is key here. I guess we solved this problem for Windows exception handling by threading the token through all the call instructions, so we can still color EH funclet regions in cases like this:

  void maythrow();
  void f() {
    try {
      maythrow();
    } catch(...) {
      throw;
    }
  }

Funclet bundles have been an ongoing maintenance burden that I would like to ease at some point, so I don't want to use that solution here.

So far we've identified two kinds of transforms that should be semantics preserving according to the rules in LangRef, but present problems with our planned lowering. Neither transform exists in LLVM today:

1. Tail merging blocks ending in unreachable where some blocks are "inside" a preallocated call region and some are outside.
2. Rolling up loops of intrinsics that establish half-open preallocated call regions. The lack of the "region close" marker in the IR is what makes this transform possible.

Similar to the case of SEH try, I think we can really only solve this with a first class scope/region concept. In the meantime, I think we should move ahead with the implementation, and try to come up with a scope/region design that works for EH, call setup, SEH __try, and perhaps stack variable lifetime. I have a draft doc with a problem statement, but I don't have a good solution yet.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74651





More information about the llvm-commits mailing list