[llvm] [InstCombine] Resolve TODO: Remove one-time check if other logic operand (Y) is constant (PR #77973)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 19 11:41:16 PST 2024
================
@@ -16,6 +14,23 @@ define i8 @shl_and(i8 %x, i8 %y) {
ret i8 %sh1
}
+define i8 @shl_and_multiuse(i8 %x) {
+; CHECK-LABEL: @shl_and_multiuse(
+; CHECK-NEXT: [[SH0:%.*]] = shl i8 [[X:%.*]], 3
+; CHECK-NEXT: call void @use(i8 [[SH0]])
+; CHECK-NEXT: [[R:%.*]] = shl i8 [[X]], 5
+; CHECK-NEXT: [[SH1:%.*]] = and i8 [[R]], -96
+; CHECK-NEXT: ret i8 [[SH1]]
+;
+ %sh0 = shl i8 %x, 3
+ %r = and i8 %sh0, 42
+ call void @use(i8 %sh0)
+ %sh1 = shl i8 %r, 2
+ ret i8 %sh1
+}
----------------
nikic wrote:
(And don't use vector tests for this purpose.)
https://github.com/llvm/llvm-project/pull/77973
More information about the llvm-commits
mailing list