]> granicus.if.org Git - llvm/commit
Merging r311229:
authorHans Wennborg <hans@hanshq.net>
Mon, 21 Aug 2017 20:07:38 +0000 (20:07 +0000)
committerHans Wennborg <hans@hanshq.net>
Mon, 21 Aug 2017 20:07:38 +0000 (20:07 +0000)
commit2effa7b8be6c9b477186e02b277ff1dad8f9ae9e
treec994b789d92093deca77ed1f0f8cbc1c5efdac11
parenta009ec4414475c51f025bfdd299d15e3def4158e
Merging r311229:
------------------------------------------------------------------------
r311229 | chandlerc | 2017-08-18 23:56:11 -0700 (Fri, 18 Aug 2017) | 19 lines

[Inliner] Fix a nasty bug when inlining a non-recursive trace of
a function into itself.

We tried to fix this before in r306495 but that got reverted as the
assert was actually hit.

This fixes the original bug (which we seem to have lost track of with
the revert) by blocking a second remapping when the function being
inlined is also the caller and the remapping could succeed but
erroneously.

The included test case would actually load from an inlined copy of the
alloca before this change, failing to load the stored value and
miscompiling.

Many thanks to Richard Smith for diagnosing a user miscompile to this
bug, and to Kyle for the first attempt and initial analysis and David Li
for remembering the issue and how to fix it and suggesting the patch.
I'm just stitching it together and landing it. =]
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@311372 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Utils/CloneFunction.cpp
test/Transforms/Inline/recursive.ll