[PATCH] D21291: [SimplifyCFG] Range reduce switches

Eli Friedman via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 20 10:50:29 PDT 2016


eli.friedman added inline comments.

================
Comment at: lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:8434
@@ -8358,3 +8433,3 @@
       // Try building a partition from Clusters[i..j].
       if (isDense(Clusters, &TotalCases[0], i, j, MinDensity)) {
         unsigned NumPartitions = 1 + (j == N - 1 ? 0 : MinPartitions[j + 1]);
----------------
hans wrote:
> hans wrote:
> > This code doesn't take into account that a range of cases could be transformed to become dense, so I'm not sure your patch will actually find any more jump table lowerings that don't cover the whole switch?
> I guess what I was saying with this comment is that since you're not going to get the benefit of transforming parts of the switch, it there a point in doing this in the DAG instead of in the IR? I think the rotation trick should work in the IR too..
Err, I guess the rotation trick works in IR?  You can let switch lowering do the compare+branch.  Not sure what I was thinking before.

That said, we don't really want to do switch lowering in IR. I mean, in theory, we can lower switches in IR, but we want to do all of switch lowering at the same time.  Otherwise, you end up with weird guessing games to predict what SelectionDAG will actually do.


Repository:
  rL LLVM

http://reviews.llvm.org/D21291





More information about the llvm-commits mailing list