diff options
author | Davide Italiano <davide@freebsd.org> | 2017-02-01 01:01:22 +0000 |
---|---|---|
committer | Davide Italiano <davide@freebsd.org> | 2017-02-01 01:01:22 +0000 |
commit | fb36e6d33b0ccba51b583be59ed15c2aec5dd1c9 (patch) | |
tree | 1740947d6903fd505a4de01fe19bd3c2a9e7538e /lib/Transforms/Scalar/SCCP.cpp | |
parent | 2415a7067f6767d767e719e5a85496945c4b3ef5 (diff) |
[IPSCCP] Teach how to not propagate return values of naked functions.
Differential Revision: https://reviews.llvm.org/D29360
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293727 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/SCCP.cpp')
-rw-r--r-- | lib/Transforms/Scalar/SCCP.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Transforms/Scalar/SCCP.cpp b/lib/Transforms/Scalar/SCCP.cpp index 334642fe35d..dd1123fd4fa 100644 --- a/lib/Transforms/Scalar/SCCP.cpp +++ b/lib/Transforms/Scalar/SCCP.cpp @@ -1712,7 +1712,10 @@ static bool runIPSCCP(Module &M, const DataLayout &DL, // If this is an exact definition of this function, then we can propagate // information about its result into callsites of it. - if (F.hasExactDefinition()) + // Don't touch naked functions. They may contain asm returning a + // value we don't see, so we may end up interprocedurally propagating + // the return value incorrectly. + if (F.hasExactDefinition() && !F.hasFnAttribute(Attribute::Naked)) Solver.AddTrackedFunction(&F); // If this function only has direct calls that we can see, we can track its |