[PATCH] D52062: [InstCombine] Inefficient pattern for high-bits checking 3 (PR38708)

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 13 14:43:32 PDT 2018


lebedev.ri created this revision.
lebedev.ri added reviewers: spatel, craig.topper, RKSimon.

It is sometimes important to check that some newly-computed value
is non-negative and only n bits wide (where n is a variable.)
There are many ways to check that:
https://godbolt.org/z/o4RB8D
The last variant seems best?
(I'm sure there are some other variations i haven't thought of..)

The last (as far i know?) pattern, non-canonical due to the extra use.
https://godbolt.org/z/aCMsPk
https://rise4fun.com/Alive/I6f

https://bugs.llvm.org/show_bug.cgi?id=38708


Repository:
  rL LLVM

https://reviews.llvm.org/D52062

Files:
  lib/Transforms/InstCombine/InstCombineCompares.cpp
  test/Transforms/InstCombine/icmp-uge-of-add-of-shl-one-by-bits-to-allones-and-val-to-icmp-eq-of-lshr-val-by-bits-and-0.ll
  test/Transforms/InstCombine/icmp-ult-of-add-of-shl-one-by-bits-to-allones-and-val-to-icmp-ne-of-lshr-val-by-bits-and-0.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52062.165388.patch
Type: text/x-patch
Size: 9788 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180913/e6c74457/attachment-0001.bin>


More information about the llvm-commits mailing list