[all-commits] [llvm/llvm-project] 2f7c24: [InstCombine] (A + B) + B --> A + (B << 1)

RotateRight via All-commits all-commits at lists.llvm.org
Fri May 22 08:53:13 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 2f7c24fe303f09308f1032515379f0abf20c5f90
      https://github.com/llvm/llvm-project/commit/2f7c24fe303f09308f1032515379f0abf20c5f90
  Author: Sanjay Patel <spatel at rotateright.com>
  Date:   2020-05-22 (Fri, 22 May 2020)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
    M llvm/test/Transforms/InstCombine/add.ll
    M llvm/test/Transforms/PGOProfile/chr.ll
    M llvm/test/Transforms/PhaseOrdering/reassociate-after-unroll.ll

  Log Message:
  -----------
  [InstCombine] (A + B) + B --> A + (B << 1)

This eliminates a use of 'B', so it can enable follow-on transforms
as well as improve analysis/codegen.

The PhaseOrdering test was added for D61726, and that shows
the limits of instcombine vs. real reassociation. We would
need to run some form of CSE to collapse that further.

The intermediate variable naming here is intentional because
there's a test at llvm/test/Bitcode/value-with-long-name.ll
that would break with the usual nameless value. I'm not sure
how to improve that test to be more robust.

The naming may also be helpful to debug regressions if this
change exposes weaknesses in the reassociation pass for example.




More information about the All-commits mailing list