[all-commits] [llvm/llvm-project] 3d9004: [InstCombine] enhance freelyNegateValue() by handl...

RotateRight via All-commits all-commits at lists.llvm.org
Wed Apr 1 12:05:23 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 3d9004879118c734fd9a5e112fb2bf22cf647668
      https://github.com/llvm/llvm-project/commit/3d9004879118c734fd9a5e112fb2bf22cf647668
  Author: Sanjay Patel <spatel at rotateright.com>
  Date:   2020-04-01 (Wed, 01 Apr 2020)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
    M llvm/test/Transforms/InstCombine/sub-of-negatible.ll

  Log Message:
  -----------
  [InstCombine] enhance freelyNegateValue() by handling xor

Negation is equivalent to bitwise-not + 1, so try to convert more
subtracts into adds using this relationship:
0 - (A ^ C) => ((A ^ C) ^ -1) + 1 => A ^ ~C + 1

I doubt this will recover the regression noted in rGf2fbdf76d8d0,
but seems like we're going to need to improve here and/or revive D68408?

Alive2 proofs:
http://volta.cs.utah.edu:8080/z/Re5tMU
http://volta.cs.utah.edu:8080/z/An-uns

Differential Revision: https://reviews.llvm.org/D77230




More information about the All-commits mailing list