[llvm-bugs] [Bug 44529] New: [InstCombine] Negation not sunk through shift

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Jan 12 11:52:23 PST 2020


            Bug ID: 44529
           Summary: [InstCombine] Negation not sunk through shift
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: nikita.ppv at gmail.com
                CC: lebedev.ri at gmail.com, llvm-bugs at lists.llvm.org

define i64 @test(i64 %a, i64 %b) {
  %sub = sub i64 %a, %b
  %mul = shl i64 %sub, 2
  %neg = sub i64 0, %mul
  ret i64 %neg

is not instcombined to

define i64 @test(i64 %a, i64 %b) {
  %sub2 = sub i64 %b, %a
  %neg = shl i64 %sub2, 2
  ret i64 %neg

This pattern showed up as a regression when testing some instcombine worklist
order changes.

I guess the most general case of this would be handled by the negator in
https://reviews.llvm.org/D68408, though a much smaller gun would do in this
case as well.

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/20200112/547e651f/attachment.html>

More information about the llvm-bugs mailing list