[llvm-commits] [llvm] r85724 - /llvm/trunk/lib/Analysis/InlineCost.cpp

Chris Lattner sabre at nondot.org
Sun Nov 1 10:16:30 PST 2009


Author: lattner
Date: Sun Nov  1 12:16:30 2009
New Revision: 85724

URL: http://llvm.org/viewvc/llvm-project?rev=85724&view=rev
Log:
add a comment about why we don't allow inlining indbr.

Modified:
    llvm/trunk/lib/Analysis/InlineCost.cpp

Modified: llvm/trunk/lib/Analysis/InlineCost.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/InlineCost.cpp?rev=85724&r1=85723&r2=85724&view=diff

==============================================================================
--- llvm/trunk/lib/Analysis/InlineCost.cpp (original)
+++ llvm/trunk/lib/Analysis/InlineCost.cpp Sun Nov  1 12:16:30 2009
@@ -159,6 +159,11 @@
   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;
 }





More information about the llvm-commits mailing list