aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Analysis/InlineCost.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-11-01 18:16:30 +0000
committerChris Lattner <sabre@nondot.org>2009-11-01 18:16:30 +0000
commit66588707acf54750dd2e3d79352df61a59be967e (patch)
tree95c23495636080affcd385152c90cedf8535fa89 /lib/Analysis/InlineCost.cpp
parent1107f03ef43b4777f0289030e1ee1b38980a7b32 (diff)
downloadexternal_llvm-66588707acf54750dd2e3d79352df61a59be967e.zip
external_llvm-66588707acf54750dd2e3d79352df61a59be967e.tar.gz
external_llvm-66588707acf54750dd2e3d79352df61a59be967e.tar.bz2
add a comment about why we don't allow inlining indbr.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85724 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/InlineCost.cpp')
-rw-r--r--lib/Analysis/InlineCost.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/Analysis/InlineCost.cpp b/lib/Analysis/InlineCost.cpp
index f6664ed..4f0b337 100644
--- a/lib/Analysis/InlineCost.cpp
+++ b/lib/Analysis/InlineCost.cpp
@@ -159,6 +159,11 @@ void CodeMetrics::analyzeBasicBlock(const BasicBlock *BB) {
if (isa<ReturnInst>(BB->getTerminator()))
++NumRets;
+ // We never want to inline functions that contain an indirectbr. This is
+ // incorrect because all the blockaddress's (e.g. in static global
+ // initializers would be referring to the original function, and this indirect
+ // jump would jump from the inlined copy of the function into the original
+ // function which is extremely undefined behavior.
if (isa<IndirectBrInst>(BB->getTerminator()))
NeverInline = true;
}