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

            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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]

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.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to