https://bugs.llvm.org/show_bug.cgi?id=47410
Bug ID: 47410
Summary: [EarlyCSE] recognize commutative intrinsics with >2
args
Product: libraries
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: Scalar Optimizations
Assignee: unassignedb...@nondot.org
Reporter: spatel+l...@rotateright.com
CC: llvm-bugs@lists.llvm.org
EarlyCSE was enhanced to recognize intrinsics that are commutative
(https://reviews.llvm.org/D86798), but it is currently restricted to arguments
with exactly 2 args.
But there are a small set of intrinsics that have commutative first 2 operands
with extra args after that:
declare i16 @llvm.smul.fix.i16(i16, i16, i32)
define i16 @intrinsic_3_args(i16 %x, i16 %y) {
%m1 = call i16 @llvm.smul.fix.i16(i16 %x, i16 %y, i32 1)
%m2 = call i16 @llvm.smul.fix.i16(i16 %y, i16 %x, i32 1)
%r = sub i16 %m1, %m2
ret i16 %r
}
$ opt commute.ll -S -gvn
define i16 @intrinsic_3_args(i16 %x, i16 %y) {
%m1 = call i16 @llvm.smul.fix.i16(i16 %x, i16 %y, i32 1)
ret i16 0
}
$ opt commute.ll -S -early-cse
define i16 @intrinsic_3_args(i16 %x, i16 %y) {
%m1 = call i16 @llvm.smul.fix.i16(i16 %x, i16 %y, i32 1)
%m2 = call i16 @llvm.smul.fix.i16(i16 %y, i16 %x, i32 1)
%r = sub i16 %m1, %m2
ret i16 %r
}
--
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