[all-commits] [llvm/llvm-project] 2fa8fc: [InstCombine] freeze operand in div+mul fold

Sanjay Patel via All-commits all-commits at lists.llvm.org
Thu May 12 10:49:47 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2fa8fc3d0afa00a96c11bdf655fa3e8d6707942c
      https://github.com/llvm/llvm-project/commit/2fa8fc3d0afa00a96c11bdf655fa3e8d6707942c
  Author: Sanjay Patel <spatel at rotateright.com>
  Date:   2022-05-12 (Thu, 12 May 2022)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
    M llvm/test/Transforms/InstCombine/add4.ll
    M llvm/test/Transforms/InstCombine/exact.ll
    M llvm/test/Transforms/InstCombine/rem.ll

  Log Message:
  -----------
  [InstCombine] freeze operand in div+mul fold

As discussed in issue #37809, this transform is not safe
if the input is an undefined value.

This is similar to recent changes for urem and sdiv:
d428f09b2c9d
99ef341ce943

There is no difference in codegen on the basic examples,
but this could lead to regressions. We may need to
improve freeze analysis or lowering if that happens.

Presumably, in real cases that are similar to the tests
where a subsequent transform removes the rem, we
will also be able to remove the freeze by seeing that
the parameter has 'noundef'.




More information about the All-commits mailing list