summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h
diff options
context:
space:
mode:
authorCong Hou <congh@google.com>2015-08-26 23:15:32 +0000
committerCong Hou <congh@google.com>2015-08-26 23:15:32 +0000
commit03127700d5eddf373eced331c4a8a5f07bd0adfe (patch)
treefe1d8c7888fb450bae52fb8db33878dab9f0980b /llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h
parentca22b869dc3ed2a3f535da31062735671880a5f8 (diff)
downloadbcm5719-llvm-03127700d5eddf373eced331c4a8a5f07bd0adfe.tar.gz
bcm5719-llvm-03127700d5eddf373eced331c4a8a5f07bd0adfe.zip
Assign weights to edges to jump table / bit test header when lowering switch statement.
Currently, when lowering switch statement and a new basic block is built for jump table / bit test header, the edge to this new block is not assigned with a correct weight. This patch collects the edge weight from all its successors and assign this sum of weights to the edge (and also the other fall-through edge). Test cases are adjusted accordingly. Differential Revision: http://reviews.llvm.org/D12166#fae6eca7 llvm-svn: 246104
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h13
1 files changed, 7 insertions, 6 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h
index 854e6d0f170..537d8e05cf2 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h
@@ -283,12 +283,12 @@ private:
typedef SmallVector<BitTestCase, 3> BitTestInfo;
struct BitTestBlock {
- BitTestBlock(APInt F, APInt R, const Value* SV,
- unsigned Rg, MVT RgVT, bool E, bool CR,
- MachineBasicBlock* P, MachineBasicBlock* D,
- BitTestInfo C):
- First(F), Range(R), SValue(SV), Reg(Rg), RegVT(RgVT), Emitted(E),
- ContiguousRange(CR), Parent(P), Default(D), Cases(std::move(C)) { }
+ BitTestBlock(APInt F, APInt R, const Value *SV, unsigned Rg, MVT RgVT,
+ bool E, bool CR, MachineBasicBlock *P, MachineBasicBlock *D,
+ BitTestInfo C, uint32_t W)
+ : First(F), Range(R), SValue(SV), Reg(Rg), RegVT(RgVT), Emitted(E),
+ ContiguousRange(CR), Parent(P), Default(D), Cases(std::move(C)),
+ Weight(W) {}
APInt First;
APInt Range;
const Value *SValue;
@@ -299,6 +299,7 @@ private:
MachineBasicBlock *Parent;
MachineBasicBlock *Default;
BitTestInfo Cases;
+ uint32_t Weight;
};
/// Minimum jump table density, in percent.
OpenPOWER on IntegriCloud