[all-commits] [llvm/llvm-project] b87a35: [NFC][InstCombine] '(X & (- Y)) - X' pattern tests...

Roman Lebedev via All-commits all-commits at lists.llvm.org
Fri Jan 3 09:27:50 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: b87a351182cd7883080fe0e82c803db71ff2ba91
      https://github.com/llvm/llvm-project/commit/b87a351182cd7883080fe0e82c803db71ff2ba91
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2020-01-03 (Fri, 03 Jan 2020)

  Changed paths:
    A llvm/test/Transforms/InstCombine/hoist-negation-out-of-bias-calculation.ll

  Log Message:
  -----------
  [NFC][InstCombine] '(X & (- Y)) - X' pattern tests (PR44448)

As discussed in https://bugs.llvm.org/show_bug.cgi?id=44448,
we can hoist negation out of the pattern.


  Commit: cc0216bedb85642e085a53bf046966fc87dd8afc
      https://github.com/llvm/llvm-project/commit/cc0216bedb85642e085a53bf046966fc87dd8afc
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2020-01-03 (Fri, 03 Jan 2020)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
    M llvm/test/Transforms/InstCombine/hoist-negation-out-of-bias-calculation.ll

  Log Message:
  -----------
  [NFC][InstCombine] '(X & (- Y)) - X' -> '- (X & (Y - 1))' fold (PR44448)

Name: (X & (- Y)) - X  ->  - (X & (Y - 1))  (PR44448)
  %negy = sub i8 0, %y
  %unbiasedx = and i8 %negy, %x
  %r = sub i8 %unbiasedx, %x
=>
  %ymask = add i8 %y, -1
  %xmasked = and i8 %ymask, %x
  %r = sub i8 0, %xmasked

https://rise4fun.com/Alive/OIpla

This decreases use count of %x, may allow us to
later hoist said negation even further,
and results in marginally nicer X86 codegen.

See
  https://bugs.llvm.org/show_bug.cgi?id=44448
  https://reviews.llvm.org/D71499


Compare: https://github.com/llvm/llvm-project/compare/04dbd449c290...cc0216bedb85


More information about the All-commits mailing list