add a comment about why we don't allow inlining indbr.
authorChris Lattner <sabre@nondot.org>
Sun, 1 Nov 2009 18:16:30 +0000 (18:16 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 1 Nov 2009 18:16:30 +0000 (18:16 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85724 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/InlineCost.cpp

index f6664ed7888433f1db86e37069451e044e240047..4f0b337807bc75be97d9520779beb2924930c8f3 100644 (file)
@@ -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;
 }