[all-commits] [llvm/llvm-project] addbda: [InstCombine] fold power-of-2 ctlz/cttz with inver...

Sanjay Patel via All-commits all-commits at lists.llvm.org
Thu Sep 1 05:59:50 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: addbdac5d580eee25146e4a8fda62fa18e6b945d
      https://github.com/llvm/llvm-project/commit/addbdac5d580eee25146e4a8fda62fa18e6b945d
  Author: Sanjay Patel <spatel at rotateright.com>
  Date:   2022-09-01 (Thu, 01 Sep 2022)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
    M llvm/test/Transforms/InstCombine/select-ctlz-to-cttz.ll
    M llvm/test/Transforms/InstCombine/xor.ll

  Log Message:
  -----------
  [InstCombine] fold power-of-2 ctlz/cttz with inverted result

When X is a power-of-two or zero and zero input is poison:
ctlz(i32 X) ^ 31 --> cttz(X)
cttz(i32 X) ^ 31 --> ctlz(X)

https://alive2.llvm.org/ce/z/Cs7sFE


  Commit: c3d1504d6316c11164e5edb9415e6fb43bb705f3
      https://github.com/llvm/llvm-project/commit/c3d1504d6316c11164e5edb9415e6fb43bb705f3
  Author: Sanjay Patel <spatel at rotateright.com>
  Date:   2022-09-01 (Thu, 01 Sep 2022)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
    M llvm/test/Transforms/InstCombine/fcmp.ll

  Log Message:
  -----------
  [InstCombine] fix crash on type mismatch with fcmp fold

The existing predicate doesn't work for a single-element
vector, so make sure we are not crossing scalar/vector types.

Test (was crashing) based on the post-commit example for:
482777123427


Compare: https://github.com/llvm/llvm-project/compare/6e1897ce9594...c3d1504d6316


More information about the All-commits mailing list