summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorHans Wennborg <hans@hanshq.net>2015-04-24 16:53:55 +0000
committerHans Wennborg <hans@hanshq.net>2015-04-24 16:53:55 +0000
commitec679a8b3bbf5ac0f9dd71df3fbc6d6985af03a9 (patch)
tree1c7ef87c197ffa11b8377b27db53a73e3e451dd1 /llvm/lib
parentcbdd0dc88a1fcf6baa494b823cb2559c01578bff (diff)
downloadbcm5719-llvm-ec679a8b3bbf5ac0f9dd71df3fbc6d6985af03a9.tar.gz
bcm5719-llvm-ec679a8b3bbf5ac0f9dd71df3fbc6d6985af03a9.zip
Switch lowering: fix APInt overflow causing infinite loop / OOM
llvm-svn: 235729
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index 14421834a55..01419cf8fa1 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -7236,7 +7236,8 @@ bool SelectionDAGBuilder::buildJumpTable(CaseClusterVector &Clusters,
for (uint64_t J = 0; J < Gap; J++)
Table.push_back(DefaultMBB);
}
- for (APInt X = Low; X.sle(High); ++X)
+ uint64_t ClusterSize = (High - Low).getLimitedValue() + 1;
+ for (uint64_t J = 0; J < ClusterSize; ++J)
Table.push_back(Clusters[I].MBB);
JTWeights[Clusters[I].MBB] += Clusters[I].Weight;
}
OpenPOWER on IntegriCloud