[all-commits] [llvm/llvm-project] 7fd8af: [InstCombine] fold mul of sext bools to 'and'

RotateRight via All-commits all-commits at lists.llvm.org
Fri Jul 3 14:29:16 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 7fd8af1de052e5bb0e07adba1d2c9e58d1a8f6a4
      https://github.com/llvm/llvm-project/commit/7fd8af1de052e5bb0e07adba1d2c9e58d1a8f6a4
  Author: Sanjay Patel <spatel at rotateright.com>
  Date:   2020-07-03 (Fri, 03 Jul 2020)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
    M llvm/test/Transforms/InstCombine/mul.ll

  Log Message:
  -----------
  [InstCombine] fold mul of sext bools to 'and'

Alive2:
  define i32 @src(i1 %x, i1 %y) {
  %0:
  %zx = sext i1 %x to i32
  %zy = sext i1 %y to i32
  %r = mul i32 %zx, %zy
  ret i32 %r
  }
  =>
  define i32 @tgt(i1 %x, i1 %y) {
  %0:
  %a = and i1 %x, %y
  %r = zext i1 %a to i32
  ret i32 %r
  }
  Transformation seems to be correct!

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




More information about the All-commits mailing list