[PATCH] D12965: [InstCombine] shrink switch conditions better (PR24766)

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 18 08:44:10 PDT 2015


spatel created this revision.
spatel added reviewers: nlewycky, sanjoy, hfinkel.
spatel added a subscriber: llvm-commits.

As noted in PR24766:
https://llvm.org/bugs/show_bug.cgi?id=24766#c2

...we're not doing a great job of optimizing/shrinking switch conditions in InstCombine. If we do better, we could remove bogus case statements.

Step 1 to solving this is to remove a hack that was added for the benefit of x86 codegen. It prevented shrinking the switch condition even to smaller legal types. 

FWIW, I don't see any perf difference on test-suite on x86 with this change, and I'm not sure how the supposed extra zext x86 instructions would hurt anyway.

http://reviews.llvm.org/D12965

Files:
  lib/Transforms/InstCombine/InstructionCombining.cpp
  test/Transforms/InstCombine/narrow-switch.ll
  test/Transforms/InstCombine/pr21651.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D12965.35088.patch
Type: text/x-patch
Size: 4540 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150918/de1270f5/attachment.bin>


More information about the llvm-commits mailing list