aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/Utils.cpp
diff options
context:
space:
mode:
authorVedant Kumar <vsk@apple.com>2019-01-04 17:43:22 +0000
committerVedant Kumar <vsk@apple.com>2019-01-04 17:43:22 +0000
commita1778df4740fc690cbab62ec74342795b84a9a5c (patch)
treefabe87231f1cbac065c7b3643171153f65cb9840 /llvm/lib/Transforms/Utils/Utils.cpp
parent722466e1f176f22d2339acb750f93498964b07ee (diff)
downloadllvm-a1778df4740fc690cbab62ec74342795b84a9a5c.zip
llvm-a1778df4740fc690cbab62ec74342795b84a9a5c.tar.gz
llvm-a1778df4740fc690cbab62ec74342795b84a9a5c.tar.bz2
[CodeExtractor] Do not extract unsafe lifetime markers
Lifetime markers which reference inputs to the extraction region are not safe to extract. Example ('rhs' will be extracted): ``` entry: +------------+ | x = alloca | | y = alloca | +------------+ / \ lhs: rhs: +-------------------+ +-------------------+ | lifetime_start(x) | | lifetime_start(x) | | use(x) | | lifetime_start(y) | | lifetime_end(x) | | use(x, y) | | lifetime_start(y) | | lifetime_end(y) | | use(y) | | lifetime_end(x) | | lifetime_end(y) | +-------------------+ +-------------------+ ``` Prior to extraction, the stack coloring pass sees that the slots for 'x' and 'y' are in-use at the same time. After extraction, the coloring pass infers that 'x' and 'y' are *not* in-use concurrently, because markers from 'rhs' are no longer available to help decide otherwise. This leads to a miscompile, because the stack slots actually are in-use concurrently in the extracted function. Fix this by moving lifetime start/end markers for memory regions defined in the calling function around the call to the extracted function. Fixes llvm.org/PR39671 (rdar://45939472). Differential Revision: https://reviews.llvm.org/D55967 llvm-svn: 350420
Diffstat (limited to 'llvm/lib/Transforms/Utils/Utils.cpp')
0 files changed, 0 insertions, 0 deletions