OSDN Git Service

[PartialInlining] Fix Crash from holding a reference to a destructed ORE.
authorSean Fertile <sfertile@ca.ibm.com>
Fri, 20 Apr 2018 19:56:26 +0000 (19:56 +0000)
committerSean Fertile <sfertile@ca.ibm.com>
Fri, 20 Apr 2018 19:56:26 +0000 (19:56 +0000)
commit7574b7ef1660fc9e8122200f4ae7e8d0bac49114
tree39ffc25573ad365acebd87356d281991340f4b94
parent14ef2bb1c44d3be7afc7cd8f3ef7ebaabb290011
[PartialInlining] Fix Crash from holding a reference to a destructed ORE.

The callback used to create an ORE for the legacy PI pass caches the allocated
object in a unique_ptr in the runOnModule function, and returns a reference to
that object. Under certian circumstances we can end up holding onto that
reference after the OREs destruction. Rather then allowing the new and legacy
passes to create ORE object in diffrent ways, create the ORE at the point of
use.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330473 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/IPO/PartialInlining.cpp
test/Transforms/CodeExtractor/PartialInlineORECrash.ll [new file with mode: 0644]