OSDN Git Service

GlobalsModRef+OptNone: Don't prove readnone/other properties from an optnone function
authorDavid Blaikie <dblaikie@gmail.com>
Tue, 6 Jun 2017 20:51:15 +0000 (20:51 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Tue, 6 Jun 2017 20:51:15 +0000 (20:51 +0000)
commit3aa7f8086331183bf8c6d4ff840699286f0ffd08
tree0cbecb12eee62d6efb99afbd099315a171d4faaf
parent698655354d44ec8d1a9f9e205a73f65be2f86fc0
GlobalsModRef+OptNone: Don't prove readnone/other properties from an optnone function

Seems like at least one reasonable interpretation of optnone is that the
optimizer never "looks inside" a function. This fix is consistent with
that interpretation.

Specifically this came up in the situation:

f3 calls f2 calls f1
f2 is always_inline
f1 is optnone

The application of readnone to f1 (& thus to f2) caused the inliner to
kill the call to f2 as being trivially dead (without even checking the
cost function, as it happens - not sure if that's also a bug).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304833 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Analysis/GlobalsModRef.cpp
unittests/Analysis/CMakeLists.txt
unittests/Analysis/GlobalsModRefTest.cpp [new file with mode: 0644]