This address part of llvm.org/PR22262. Specifically, it prevents counting a single element as having a density of 1 and thereby outweighing all other split points.
This is not a complete solution but works around the most pressing issue.
|  Differential  D7070  
Prevent binary-tree deterioration in sparse trees. Authored by djasper on Jan 20 2015, 10:22 AM. 
Details 
Diff Detail Event TimelineComment Actions If Hans is OK with this as an interim solution, I am too. I would still like to see us split off table regions. Comment Actions I'm fine with this as an incremental improvement. 
 Comment Actions Updated according to comments. Comment Actions Still lgtm. 
 Comment Actions Addressed comment and submitted as r226600. 
 | |||||||||||||||||||||
Maybe add a comment about why we're doing this check?