[PATCH] D120337: [InstCombine] Remove one-use limitation from X-Y==0 fold

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 22 09:04:37 PST 2022


nikic created this revision.
nikic added reviewers: spatel, lebedev.ri.
Herald added a subscriber: hiraditya.
nikic requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This one-use limitation is artificial, we do not increase instruction count if we fold it with multiple uses. The motivating case is shown in `@sub_eq_zero_select`, where the one-use limitation causes us to miss a subsequent select fold.

I believe the backend is pretty good about reusing flag-producing subs for cmps with same operands, so I //think// doing this is fine.


https://reviews.llvm.org/D120337

Files:
  llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
  llvm/test/Transforms/InstCombine/icmp-sub.ll
  llvm/test/Transforms/InstCombine/prevent-cmp-merge.ll
  llvm/test/Transforms/InstCombine/result-of-usub-is-non-zero-and-no-overflow.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D120337.410555.patch
Type: text/x-patch
Size: 17207 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220222/768dac36/attachment-0001.bin>


More information about the llvm-commits mailing list