[all-commits] [llvm/llvm-project] 24f674: [InstCombine] foldAddWithConstant(): don't deal wi...

Roman Lebedev via All-commits all-commits at lists.llvm.org
Wed Apr 7 09:51:09 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 24f67473dd1253f484e10fd5dfbed95489487b60
      https://github.com/llvm/llvm-project/commit/24f67473dd1253f484e10fd5dfbed95489487b60
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2021-04-07 (Wed, 07 Apr 2021)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
    M llvm/test/Transforms/InstCombine/sub-from-sub.ll

  Log Message:
  -----------
  [InstCombine] foldAddWithConstant(): don't deal with non-immediate constants

All of the code that handles general constant here (other than the more
restrictive APInt-dealing code) expects that it is an immediate,
because otherwise we won't actually fold the constants, and increase
instruction count. And it isn't obvious why we'd be okay with
increasing the number of constant expressions,
those still will have to be run..

But after 2829094a8e252d04f13aabdf6f416c42a06af695
this could also cause endless combine loops.
So actually properly restrict this code to immediates.




More information about the All-commits mailing list