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

            Bug ID: 42720
           Summary: [InstCombine] Not-of-and or or-of-not's ?
           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]

https://godbolt.org/z/Ojj1d0

declare { i4, i1 } @llvm.smul.with.overflow.i4(i4, i4) #1

define i1 @t0_umul_sinked(i4 %size, i4 %nmemb) {
  %cmp = icmp eq i4 %size, 0
  %smul = tail call { i4, i1 } @llvm.smul.with.overflow.i4(i4 %size, i4 %nmemb)
  %smul.ov = extractvalue { i4, i1 } %smul, 1
  %phitmp = xor i1 %smul.ov, true
  %or = or i1 %cmp, %phitmp
  ret i1 %or
}

define i1 @t0_umu2222l_hoisted(i4 %size, i4 %nmemb) {
  %cmp = icmp ne i4 %size, 0
  %smul = tail call { i4, i1 } @llvm.smul.with.overflow.i4(i4 %size, i4 %nmemb)
  %smul.ov = extractvalue { i4, i1 } %smul, 1
  %or = and i1 %cmp, %smul.ov
  %not = xor i1 %or, -1
  ret i1 %not
}

We could transform one into another freely, but we don't.
https://rise4fun.com/Alive/1Uy8

Shall we have a preference here?

-- 
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