]> granicus.if.org Git - llvm/commit
[InstCombine] Don't sink dynamic allocas
authorReid Kleckner <rnk@google.com>
Thu, 17 Jan 2019 20:46:53 +0000 (20:46 +0000)
committerReid Kleckner <rnk@google.com>
Thu, 17 Jan 2019 20:46:53 +0000 (20:46 +0000)
commitdbe36707c00bffc741f8c8bc259c158dfd1febdf
tree2a57498276cd39c21dc14f2f3376dcb1f41c1499
parentcc6eedfcf341fb40b6c876ea10cf5db81fb2124f
[InstCombine] Don't sink dynamic allocas

Summary:
InstCombine's sinking algorithm only thinks about memory. It doesn't
think about non-memory constraints like stack object lifetime. It can
sink dynamic allocas across a stacksave call, which may be used with
stackrestore, which can incorrectly reduce the lifetime of the dynamic
alloca.

Fixes PR40365

Reviewers: hfinkel, efriedma

Subscribers: hiraditya, llvm-commits

Differential Revision: https://reviews.llvm.org/D56872

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@351475 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/InstCombine/InstructionCombining.cpp
test/Transforms/InstCombine/sink-alloca.ll [new file with mode: 0644]