[PATCH] D155773: [llvm][MemoryBuiltins] Add alloca support to getInitialValueOfAllocation

Nikita Popov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 14 03:24:23 PDT 2023


nikic added a comment.

@jmciver Thanks for the context. I would recommend you to put up the patch you have based on top of this, because it's pretty hard to tell whether this API design makes sense without seeing the use. I have some doubts about that, for two reasons:

- If I understand correctly, for your use case getInitialValueOfAllocation() can't just return a constant anymore, it may have to insert an instruction. Additionally, there is no longer a single "initial value", but it may wary between different loads from the same allocation. This means that the API is going to change to the point that getInitialValueOfAllocation() is no longer recognizable (and probably no longer correctly named -- it would be more materializeInitialValueOfAllocation()).
- As some of the changes in this patch show, we also have to give lifetime.start intrinsics similar treatment to allocas, but this doesn't quite fit the current API.

I think supporting allocas in getInitialValueOfAllocation() is perfectly fine, but I'm not sure this really brings you closer to what you want to do.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D155773



More information about the cfe-commits mailing list