[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
Tue Jan 16 01:08:34 PST 2024


================
@@ -16,6 +16,16 @@ define i8 @shl_and(i8 %x, i8 %y) {
   ret i8 %sh1
 }
 
+define i8 @shl_and_constant(i8 %x) {
+; CHECK-LABEL: @shl_and_constant(
+; CHECK-NEXT:    ret i8 0
+;
+  %sh0 = shl i8 %x, 3
+  %r = and i8 %sh0, 2
+  %sh1 = shl i8 %r, 2
+  ret i8 %sh1
+}
----------------
nikic wrote:

All of these tests are still irrelevant, because they don't test a multi-use scenario. They will behave the same before and after your patch.

https://github.com/llvm/llvm-project/pull/77973


More information about the llvm-commits mailing list