summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Analysis/InlineCost.cpp3
-rw-r--r--llvm/lib/Analysis/SparsePropagation.cpp5
2 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/InlineCost.cpp b/llvm/lib/Analysis/InlineCost.cpp
index febdd9101c8..559f468bd64 100644
--- a/llvm/lib/Analysis/InlineCost.cpp
+++ b/llvm/lib/Analysis/InlineCost.cpp
@@ -31,6 +31,9 @@ unsigned InlineCostAnalyzer::FunctionInfo::
// Eliminating a switch is a big win, proportional to the number of edges
// deleted.
Reduction += (SI->getNumSuccessors()-1) * 40;
+ else if (isa<IndBrInst>(*UI))
+ // Eliminating an indirect branch is a big win.
+ Reduction += 200;
else if (CallInst *CI = dyn_cast<CallInst>(*UI)) {
// Turning an indirect call into a direct call is a BIG win
Reduction += CI->getCalledValue() == V ? 500 : 0;
diff --git a/llvm/lib/Analysis/SparsePropagation.cpp b/llvm/lib/Analysis/SparsePropagation.cpp
index b7844f02276..6578cb4681e 100644
--- a/llvm/lib/Analysis/SparsePropagation.cpp
+++ b/llvm/lib/Analysis/SparsePropagation.cpp
@@ -166,6 +166,11 @@ void SparseSolver::getFeasibleSuccessors(TerminatorInst &TI,
return;
}
+ if (IndBrInst *IBI = dyn_cast<IndBrInst>(TI)) {
+ Succs.assign(Succs.size(), true);
+ return;
+ }
+
SwitchInst &SI = cast<SwitchInst>(TI);
LatticeVal SCValue;
if (AggressiveUndef)
OpenPOWER on IntegriCloud