summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Desaulniers <ndesaulniers@google.com>2019-02-14 23:42:21 +0000
committerNick Desaulniers <ndesaulniers@google.com>2019-02-14 23:42:21 +0000
commit6a84cd3b8eaa4ef5966bd8521041434edc38190f (patch)
tree65bca86db4f19b44b67cf4ddebe1dc8c94c5c9ef
parentc3aefedc4697869f47f993f7003bc389aa97dd98 (diff)
downloadbcm5719-llvm-6a84cd3b8eaa4ef5966bd8521041434edc38190f.tar.gz
bcm5719-llvm-6a84cd3b8eaa4ef5966bd8521041434edc38190f.zip
Revert "[INLINER] allow inlining of address taken blocks"
This reverts commit 19e95fe61182945b7b68ad15348f144fb996633f. llvm-svn: 354082
-rw-r--r--llvm/include/llvm/IR/BasicBlock.h5
-rw-r--r--llvm/lib/Analysis/InlineCost.cpp4
-rw-r--r--llvm/lib/IR/BasicBlock.cpp8
3 files changed, 2 insertions, 15 deletions
diff --git a/llvm/include/llvm/IR/BasicBlock.h b/llvm/include/llvm/IR/BasicBlock.h
index 076adad7cf7..fd9efb8417e 100644
--- a/llvm/include/llvm/IR/BasicBlock.h
+++ b/llvm/include/llvm/IR/BasicBlock.h
@@ -390,11 +390,6 @@ public:
/// direct branches, switches, etc. to it.
bool hasAddressTaken() const { return getSubclassDataFromValue() != 0; }
- /// Returns true if there are any uses of the address of this basic block
- /// that are call instructions (which may allow the address of this basic
- /// block to escape).
- bool addressPotentiallyEscapesFunction();
-
/// Update all phi nodes in this basic block's successors to refer to basic
/// block \p New instead of to it.
void replaceSuccessorsPhiUsesWith(BasicBlock *New);
diff --git a/llvm/lib/Analysis/InlineCost.cpp b/llvm/lib/Analysis/InlineCost.cpp
index 2f5aa4a2576..574a1b6c841 100644
--- a/llvm/lib/Analysis/InlineCost.cpp
+++ b/llvm/lib/Analysis/InlineCost.cpp
@@ -1832,7 +1832,7 @@ InlineResult CallAnalyzer::analyzeCall(CallSite CS) {
// see an indirect branch that ends up being dead code at a particular call
// site. If the blockaddress escapes the function, e.g., via a global
// variable, inlining may lead to an invalid cross-function reference.
- if (BB->hasAddressTaken() && BB->addressPotentiallyEscapesFunction())
+ if (BB->hasAddressTaken())
return "blockaddress";
// Analyze the cost of this block. If we blow through the threshold, this
@@ -2082,7 +2082,7 @@ InlineResult llvm::isInlineViable(Function &F) {
if (isa<IndirectBrInst>(BI->getTerminator()))
return "contains indirect branches";
- if (BI->hasAddressTaken() && BI->addressPotentiallyEscapesFunction())
+ if (BI->hasAddressTaken())
return "uses block address";
for (auto &II : *BI) {
diff --git a/llvm/lib/IR/BasicBlock.cpp b/llvm/lib/IR/BasicBlock.cpp
index 7f2e762c29a..18e2fd898f7 100644
--- a/llvm/lib/IR/BasicBlock.cpp
+++ b/llvm/lib/IR/BasicBlock.cpp
@@ -442,14 +442,6 @@ BasicBlock *BasicBlock::splitBasicBlock(iterator I, const Twine &BBName) {
return New;
}
-bool BasicBlock::addressPotentiallyEscapesFunction() {
- for (const Use& U : BlockAddress::get(this)->uses())
- if (const CallInst* CI = dyn_cast<CallInst>(U))
- if (!CI->paramHasAttr(U.getOperandNo(), Attribute::NoCapture))
- return true;
- return false;
-}
-
void BasicBlock::replaceSuccessorsPhiUsesWith(BasicBlock *New) {
Instruction *TI = getTerminator();
if (!TI)
OpenPOWER on IntegriCloud