https://bugs.llvm.org/show_bug.cgi?id=42459
Bug ID: 42459
Summary: [InstCombine] ((~x) + y) + 1 -> y - x fold
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Scalar Optimizations
Assignee: unassignedb...@nondot.org
Reporter: lebedev...@gmail.com
CC: llvm-bugs@lists.llvm.org
While this fold is nominally supported, it only happens due to some other
folds,
so it is missed if there are extra uses:
https://godbolt.org/z/ujsxHs
https://rise4fun.com/Alive/EPO0
declare void @use32(i32)
define i32 @t2(i32 %x, i32 %y) {
%o0 = xor i32 %x, -1
%o1 = add i32 %o0, %y
call void @use32(i32 %o1)
%o2 = add i32 %o1, 1
ret i32 %o2
}
Name: ((~x) + y) + 1 -> y - x
%o0 = xor i32 %x, -1
%o1 = add i32 %o0, %y
%r = add i32 %o1, 1
=>
%r = sub i32 %y, %x
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs