[PATCH] D39262: [CodeGen] Peel off the dominant case in switch statement in lowering
Hans Wennborg via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 6 16:20:59 PST 2017
hans added inline comments.
================
Comment at: test/CodeGen/Generic/switch-lower-peel-top-case.ll:72
+; CHECK: %{{[0-9]+}}:gr32 = ADD32ri8 %{{[0-9]+}}, -85, implicit-def dead %eflags
+; CHECK: %{{[0-9]+}}:gr32 = SUB32ri8 %{{[0-9]+}}, 2, implicit-def %eflags
+; CHECK: JB_1 %[[RETURN_LABEL]], implicit %eflags
----------------
Actually, I think this test would pass even without switch peeling.
Since there are only three clusters, it will do straight-line comparisons, with the most probable one (i.e. 85-86) first.
I'd suggest adding a few more cases, so that the remaining cases are lowered with a binary tree. That will show more clearly that the switch is getting peeled.
https://reviews.llvm.org/D39262
More information about the llvm-commits
mailing list