summaryrefslogtreecommitdiffstats
path: root/llvm/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
commit1756673f58c34a7f3ccb5757826ee8a841e24414 (patch)
tree678a38e647531c8cbb707d9f91d9737e56852ab2 /llvm/lib/Analysis/InlineCost.cpp
parent50bc004b676a3415861886886989c705771f37cd (diff)
downloadbcm5719-llvm-1756673f58c34a7f3ccb5757826ee8a841e24414.tar.gz
bcm5719-llvm-1756673f58c34a7f3ccb5757826ee8a841e24414.zip
add a comment about why we don't allow inlining indbr.
llvm-svn: 85724
Diffstat (limited to 'llvm/lib/Analysis/InlineCost.cpp')
-rw-r--r--llvm/lib/Analysis/InlineCost.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/InlineCost.cpp b/llvm/lib/Analysis/InlineCost.cpp
index f6664ed7888..4f0b337807b 100644
--- a/llvm/lib/Analysis/InlineCost.cpp
+++ b/llvm/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;
}
OpenPOWER on IntegriCloud