[all-commits] [llvm/llvm-project] 80c34f: [InstCombine] Add test for PR44529; NFC

Nikita Popov via All-commits all-commits at lists.llvm.org
Wed Jan 22 14:04:13 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 80c34f94acdbcbd8b02f61d89b100ff24ac39496
      https://github.com/llvm/llvm-project/commit/80c34f94acdbcbd8b02f61d89b100ff24ac39496
  Author: Nikita Popov <nikita.ppv at gmail.com>
  Date:   2020-01-22 (Wed, 22 Jan 2020)

  Changed paths:
    M llvm/test/Transforms/InstCombine/sub.ll

  Log Message:
  -----------
  [InstCombine] Add test for PR44529; NFC


  Commit: 0b83c5a78fae96dd66150e7a14c8c6d0292de01d
      https://github.com/llvm/llvm-project/commit/0b83c5a78fae96dd66150e7a14c8c6d0292de01d
  Author: Nikita Popov <nikita.ppv at gmail.com>
  Date:   2020-01-22 (Wed, 22 Jan 2020)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
    M llvm/lib/Transforms/InstCombine/InstCombineInternal.h
    M llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
    M llvm/test/Transforms/InstCombine/sub.ll

  Log Message:
  -----------
  [InstCombine] Combine neg of shl of sub (PR44529)

Fixes https://bugs.llvm.org/show_bug.cgi?id=44529. We already have
a combine to sink a negation through a left-shift, but it currently
only works if the shift operand is negatable without creating any
instructions. This patch introduces freelyNegateValue() as a more
powerful extension of dyn_castNegVal(), which allows negating a
value as long as this doesn't end up increasing instruction count.
Specifically, this patch adds support for negating A-B to B-A.

This mechanism could in the future be extended to handle general
negation chains that a) start at a proper 0-X negation and b) only
require one operand to be freely negatable. This would end up as a
weaker form of D68408 aimed at the most obviously profitable subset
that eliminates a negation entirely.

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


Compare: https://github.com/llvm/llvm-project/compare/16b9410caa35...0b83c5a78fae


More information about the All-commits mailing list