[PATCH] D54552: [InstSimplify] delete shift-of-zero guard ops around funnel shifts

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 14 15:41:36 PST 2018


spatel created this revision.
spatel added reviewers: fabiang, efriedma, RKSimon.
Herald added a subscriber: mcrosier.

This is a problem seen in common rotate idioms as noted in:
https://bugs.llvm.org/show_bug.cgi?id=34924

Note that we are not canonicalizing standard IR (shifts and logic) to the intrinsics yet. (Although I've written this before...) I think this is the last step before we enable that transform. Ie, we could regress code by doing that transform without this simplification in place.

In PR34924, I questioned whether this is a valid transform for target-independent IR, but I convinced myself this is ok. If we're speculating a funnel shift by turning cmp+br into select, then SimplifyCFG has already determined that the transform is justified. It's possible that SimplifyCFG is not taking into account profile or other metadata, but if that's true, then it's a bug independent of funnel shifts.

Also, we do have CGP code to restore a guard like this around an intrinsic if it can't be lowered cheaply. But that isn't necessary for funnel shift because the default expansion in SelectionDAGBuilder includes this same cmp+select.


https://reviews.llvm.org/D54552

Files:
  lib/Analysis/InstructionSimplify.cpp
  test/Transforms/InstSimplify/call.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54552.174108.patch
Type: text/x-patch
Size: 8350 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181114/e118b3e9/attachment.bin>


More information about the llvm-commits mailing list