[PATCH] D136285: Bad optimization with alloca and intrinsic function stackrestore

Jamie Schmeiser via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 19 12:44:07 PDT 2022


jamieschmeiser created this revision.
jamieschmeiser added a reviewer: rnk.
Herald added subscribers: jeroen.dobbelaere, hiraditya.
Herald added a project: All.
jamieschmeiser requested review of this revision.
Herald added a project: LLVM.

Fix the alias analysis handling of stackrestore.

See IR in function test in new lit test for example code that is mis-optimized.
Alias analysis does not detect properly that an alloca is clobbered by a call to
the intrinsic function llvm.stackrestore.

      

Fix the handling of stackrestore by moving it forward in the function before
the handling of tail call functions since stackrestore is a tail call function.
Also, remove the requirement that the alloca being considered not be a static
alloca since the alloca can be after the stacksave in the entry block of
a function.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D136285

Files:
  llvm/lib/Analysis/BasicAliasAnalysis.cpp
  llvm/test/Transforms/MemCpyOpt/stackrestore.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D136285.469010.patch
Type: text/x-patch
Size: 4879 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221019/828714d7/attachment.bin>


More information about the llvm-commits mailing list