[llvm-bugs] [Bug 46897] New: Failure to recognise commutable binop intrinsics

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jul 29 09:48:47 PDT 2020


https://bugs.llvm.org/show_bug.cgi?id=46897

            Bug ID: 46897
           Summary: Failure to recognise commutable binop intrinsics
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: llvm-dev at redking.me.uk
                CC: lebedev.ri at gmail.com, llvm-bugs at lists.llvm.org,
                    spatel+llvm at rotateright.com

define <2 x i64> @smax(<2 x i64> %a, <2 x i64> %b) {
  %x = call <2 x i64> @llvm.smax.v2i64(<2 x i64> %a, <2 x i64> %b)
  %y = call <2 x i64> @llvm.smax.v2i64(<2 x i64> %b, <2 x i64> %a)
  %o = or <2 x i64> %x, %y
  ret <2 x i64> %o
}
declare <2 x i64> @llvm.smax.v2i64(<2 x i64>, <2 x i64>)

opt -O3

define <2 x i64> @smax(<2 x i64> %a, <2 x i64> %b) {
  %x = tail call <2 x i64> @llvm.smax.v2i64(<2 x i64> %a, <2 x i64> %b)
  %y = tail call <2 x i64> @llvm.smax.v2i64(<2 x i64> %b, <2 x i64> %a)
  %o = or <2 x i64> %x, %y
  ret <2 x i64> %o
}

but we should be able to recognise that %x and %y are equivalent:

define <2 x i64> @smax(<2 x i64> %a, <2 x i64> %b) {
  %x = tail call <2 x i64> @llvm.smax.v2i64(<2 x i64> %a, <2 x i64> %b)
  ret <2 x i64> %x
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200729/2d60c1c1/attachment.html>


More information about the llvm-bugs mailing list