[all-commits] [llvm/llvm-project] d61187: [InstSimplify] add tests for inverted logic operan...

RotateRight via All-commits all-commits at lists.llvm.org
Mon Dec 21 06:15:15 PST 2020


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d6118759f30e343a05aab053f66e5049ea149175
      https://github.com/llvm/llvm-project/commit/d6118759f30e343a05aab053f66e5049ea149175
  Author: Sanjay Patel <spatel at rotateright.com>
  Date:   2020-12-21 (Mon, 21 Dec 2020)

  Changed paths:
    M llvm/test/Transforms/InstSimplify/AndOrXor.ll

  Log Message:
  -----------
  [InstSimplify] add tests for inverted logic operands; NFC


  Commit: 38ca7face67e8488d482b66a999d0a685806879f
      https://github.com/llvm/llvm-project/commit/38ca7face67e8488d482b66a999d0a685806879f
  Author: Sanjay Patel <spatel at rotateright.com>
  Date:   2020-12-21 (Mon, 21 Dec 2020)

  Changed paths:
    M llvm/lib/Analysis/InstructionSimplify.cpp
    M llvm/test/Transforms/InstSimplify/AndOrXor.ll

  Log Message:
  -----------
  [InstSimplify] reduce logic with inverted add/sub ops

https://llvm.org/PR48559
This could be part of a larger ValueTracking API,
but I don't see that currently.

https://rise4fun.com/Alive/gR0

  Name: and
  Pre: C1 == ~C2
  %sub = add i8 %x, C1
  %sub1 = sub i8 C2, %x
  %r = and i8 %sub, %sub1
  =>
  %r = 0

  Name: or
  Pre: C1 == ~C2
  %sub = add i8 %x, C1
  %sub1 = sub i8 C2, %x
  %r = or i8 %sub, %sub1
  =>
  %r = -1

  Name: xor
  Pre: C1 == ~C2
  %sub = add i8 %x, C1
  %sub1 = sub i8 C2, %x
  %r = xor i8 %sub, %sub1
  =>
  %r = -1


Compare: https://github.com/llvm/llvm-project/compare/8c2ad9e85f67...38ca7face67e


More information about the All-commits mailing list