[llvm] [InstCombine] Resolve TODO: Remove one-time check if other logic operand (Y) is constant (PR #77973)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 19 12:51:06 PST 2024
================
@@ -29,6 +31,21 @@ define <2 x i8> @shl_and_nonuniform(<2 x i8> %x, <2 x i8> %y) {
ret <2 x i8> %sh1
}
+define <2 x i8> @shl_and_nonuniform_multiuse(<2 x i8> %x) {
+; CHECK-LABEL: @shl_and_nonuniform_multiuse(
+; CHECK-NEXT: [[SH0:%.*]] = shl <2 x i8> [[X:%.*]], <i8 3, i8 4>
+; CHECK-NEXT: call void @use1(<2 x i8> [[SH0]])
+; CHECK-NEXT: [[TMP1:%.*]] = shl <2 x i8> [[X]], <i8 5, i8 4>
+; CHECK-NEXT: [[SH1:%.*]] = and <2 x i8> [[TMP1]], <i8 -88, i8 42>
+; CHECK-NEXT: ret <2 x i8> [[SH1]]
+;
+ %sh0 = shl <2 x i8> %x, <i8 3, i8 4>
+ %r = and <2 x i8> %sh0, <i8 42, i8 42> ; constant operand on the 'and'
+ call void @use1(<2 x i8> %sh0)
+ %sh1 = shl <2 x i8> %r, <i8 2, i8 0>
+ ret <2 x i8> %sh1
+}
----------------
AtariDreams wrote:
@nikic ok
https://github.com/llvm/llvm-project/pull/77973
More information about the llvm-commits
mailing list