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

Arthur Eubanks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 22 15:15:51 PDT 2020


aeubanks added a comment.

Reid and I talked a bit and decided that this hadn't handled the case of when there's a setup without a call (e.g. via DCE). The stack adjustment will happen, but without the call the stack won't be cleaned up. One solution is turn the calls to llvm.call.preallocated.arg into allocas. But we need to know the type of the argument, and without the call we don't have that info. One solution is to add a call site attribute to llvm.call.preallocated.arg with the type. I reused the preallocated attribute for this purpose.
One downside of this approach is that alloca returns a pointer of the proper type, but llvm.call.preallocated.arg returns i8*. And we likely are casting the i8* to the actual pointer type we want, so there will likely be two unnecessary casts when cleaning up setups without calls. But maybe that doesn't matter so much.

Thoughts on this approach?


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