From 11944e39d40bab89e9d16982555a83ed1af9c226 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sun, 1 Nov 2009 18:16:30 +0000 Subject: [PATCH] add a comment about why we don't allow inlining indbr. llvm-svn: 85724 --- lib/Analysis/InlineCost.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/Analysis/InlineCost.cpp b/lib/Analysis/InlineCost.cpp index f6664ed7888..4f0b337807b 100644 --- a/lib/Analysis/InlineCost.cpp +++ b/lib/Analysis/InlineCost.cpp @@ -159,6 +159,11 @@ void CodeMetrics::analyzeBasicBlock(const BasicBlock *BB) { if (isa(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(BB->getTerminator())) NeverInline = true; }