[PATCH] D18604: Target hook to control Switch lowering.

Marcello Maggioni via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 30 09:32:27 PDT 2016


kariddi added a comment.

Hmm, that is actually a possible interesting approach. Right now processSwitchInst is not callable from outside, the LowerSwitch pass, but maybe we could make it a utility function, like SimplifyCFG.

Otherwise, the original idea of the patch is to give more control to the target about the way switches are lowered.

You are right that the SelectionDAGBuilder lowering wouldn't be addressed by this and I'm wondering if it would actually make sense to add a custom lowering hook in SelectionDAGBuilder to be able to emit a target instruction representing a switch instead of an expansion of branches that would be very difficult to understand we are dealing with a switch and roll it back.

What do you think? I'm not very familiar on how the selectiondagbuilder emits the expansion. It seems to be creating the same kind of tree if jump tables are not available and creates additional basic blocks, so doesn't look easily "rollbackable".


Repository:
  rL LLVM

http://reviews.llvm.org/D18604





More information about the llvm-commits mailing list