[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
Mon Jan 22 01:55:18 PST 2024
================
@@ -430,6 +430,21 @@ define i8 @shl_sub(i8 %x, i8 %y) {
ret i8 %sh1
}
+define i8 @shl_sub_multiuse(i8 %x) {
+; CHECK-LABEL: @shl_sub_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:%.*]] = add i8 [[R]], 88
+; CHECK-NEXT: ret i8 [[SH1]]
+;
+ %sh0 = shl i8 %x, 3
+ %r = sub i8 %sh0, 42
+ call void @use(i8 %sh0)
+ %sh1 = shl i8 %r, 2
+ ret i8 %sh1
+}
----------------
nikic wrote:
Please add the variant with a non-constant operand again...
https://github.com/llvm/llvm-project/pull/77973
More information about the llvm-commits
mailing list