Make 91378 more conservative.
[oota-llvm.git] / lib / Analysis / InlineCost.cpp
index f6664ed7888433f1db86e37069451e044e240047..bd9377bf87fbec2caa3ca07cd8dfeea6ea9d2403 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 (in static global initializers
+  // for example) 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;
 }