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

Hans Wennborg via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 30 08:55:15 PDT 2016


hans added a comment.

This adds to the confusion about the two different switch lowering implementations.

As far as I can tell, none of the in-tree targets in LLVM use this "default lower switch pass" except AMDGPU. All the others use SelectionDAGBuilder.

For example, on X86 your TargetTransformInfo::shouldLowerSwitch() method would return true, indicating that it wants to use LowerSwitch, except that it doesn't, and that pass isn't even in the pipeline for X86. Pretty confusing.

IIUC, LowerSwitch gets run because StructurizeCFG depends on it. Could you make this dependency optional, and then instead of running LowerSwitch directly in your target, run a custom pass that looks at the switches and either runs LowerSwitch on them or leaves them alone / does something else?

This patch is also missing tests.


Repository:
  rL LLVM

http://reviews.llvm.org/D18604





More information about the llvm-commits mailing list