[NFC][InstCombine] Add test for PR49778
authorRoman Lebedev <lebedev.ri@gmail.com>
Sun, 4 Apr 2021 20:15:29 +0000 (23:15 +0300)
committerRoman Lebedev <lebedev.ri@gmail.com>
Sun, 4 Apr 2021 20:26:41 +0000 (23:26 +0300)
llvm/test/Transforms/InstCombine/redundant-left-shift-input-masking-pr49778.ll [new file with mode: 0644]

diff --git a/llvm/test/Transforms/InstCombine/redundant-left-shift-input-masking-pr49778.ll b/llvm/test/Transforms/InstCombine/redundant-left-shift-input-masking-pr49778.ll
new file mode 100644 (file)
index 0000000..4865afa
--- /dev/null
@@ -0,0 +1,15 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt < %s -instcombine -S | FileCheck %s
+
+; PR49778: this should not be folded to 0.
+define i32 @src(i1 %x2) {
+; CHECK-LABEL: @src(
+; CHECK-NEXT:    ret i32 0
+;
+  %x13 = zext i1 %x2 to i32
+  %_7 = shl i32 4294967295, %x13
+  %mask = xor i32 %_7, 4294967295
+  %_8 = and i32 %mask, %x13
+  %_9 = shl i32 %_8, %x13
+  ret i32 %_9
+}