[PATCH] D138814: [InstCombine] Combine a/lshr of add -> uadd.with.overflow

Pierre van Houtryve via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 9 02:21:49 PST 2022


Pierre-vh updated this revision to Diff 481580.
Pierre-vh added a comment.

Change to (a + b < a); don't combine if ShAmt == 1.

Seems like CGP does the conversion to uaddo; or at least in AMDGPU's case codegen is the same for uaddo/(a + b < a): https://godbolt.org/z/zfnorbvzr

We seem to have more bitwise operations now, is it expected to see the add folded into other operations? (xor/and)
Should I restrict the combine to ShAmt > 2?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D138814/new/

https://reviews.llvm.org/D138814

Files:
  llvm/include/llvm/Analysis/ValueTracking.h
  llvm/include/llvm/Transforms/InstCombine/InstCombiner.h
  llvm/lib/Analysis/ValueTracking.cpp
  llvm/lib/Transforms/InstCombine/InstCombineInternal.h
  llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp
  llvm/test/Transforms/InstCombine/lshr.ll
  llvm/test/Transforms/InstCombine/pr34349.ll
  llvm/test/Transforms/InstCombine/shift-add.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D138814.481580.patch
Type: text/x-patch
Size: 18753 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221209/57a3fc0e/attachment.bin>


More information about the llvm-commits mailing list