aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2011-10-20 04:05:33 +0000
committerEli Friedman <eli.friedman@gmail.com>2011-10-20 04:05:33 +0000
commit531afb166c28d20b34de657ef772694e30775ca0 (patch)
treed2f5b1485f8499e880384f3ddc63cf5e89be03f5
parent400ea5bde0a1154ba68ef7a0b1af6f0274cd6916 (diff)
A FIXME about block addresses and indirectbr.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142569 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Analysis/InlineCost.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/Analysis/InlineCost.cpp b/lib/Analysis/InlineCost.cpp
index 40ac9a211a..1f332e84e6 100644
--- a/lib/Analysis/InlineCost.cpp
+++ b/lib/Analysis/InlineCost.cpp
@@ -135,6 +135,12 @@ void CodeMetrics::analyzeBasicBlock(const BasicBlock *BB,
// 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.
+ // FIXME: This logic isn't really right; we can safely inline functions
+ // with indirectbr's as long as no other function or global references the
+ // blockaddress of a block within the current function. And as a QOI issue,
+ // if someone is using a blockaddress wihtout an indirectbr, and that
+ // reference somehow ends up in another function or global, we probably
+ // don't want to inline this function.
if (isa<IndirectBrInst>(BB->getTerminator()))
containsIndirectBr = true;