[PATCH] D109749: Experimental Partial Mem2Reg

Graham Hunter via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 5 03:46:52 PDT 2021


huntergr updated this revision to Diff 385009.
huntergr added a comment.

Added the ability to look through GEPs for a call. I've limited this to using indexes of all 0, and only for single value types, so I'm not sure how often we'll encounter that. The limitation on the indexes does match the existing checks for whether promotion is allowed.

It should be possible to perform this optimization for a single field in a struct and allow sroa to replace the rest of the struct, but I think there's at least some C code which relies on being able to cast back to the struct (not sure if that's fully legal in C, but such code does exist). Maybe going further will need analysis of the callee function to see whether it just treats the pointer as a single value or assumes it can access more than that.


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

https://reviews.llvm.org/D109749

Files:
  llvm/include/llvm/Transforms/Scalar/SROA.h
  llvm/include/llvm/Transforms/Utils/PromoteMemToReg.h
  llvm/lib/Transforms/Scalar/SROA.cpp
  llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
  llvm/test/Transforms/PhaseOrdering/lifetime-sanitizer.ll
  llvm/test/Transforms/SROA/non-capturing-call.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D109749.385009.patch
Type: text/x-patch
Size: 12788 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211105/ce15ccfc/attachment.bin>


More information about the llvm-commits mailing list