[llvm] 55aa4e9 - [InstCombine] add test for shift-shift with extra use; NFC

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 22 13:32:22 PDT 2021


Author: Sanjay Patel
Date: 2021-09-22T16:31:12-04:00
New Revision: 55aa4e92f7374f01ef8d3c2f793a8666a1b13dca

URL: https://github.com/llvm/llvm-project/commit/55aa4e92f7374f01ef8d3c2f793a8666a1b13dca
DIFF: https://github.com/llvm/llvm-project/commit/55aa4e92f7374f01ef8d3c2f793a8666a1b13dca.diff

LOG: [InstCombine] add test for shift-shift with extra use; NFC

Added: 
    

Modified: 
    llvm/test/Transforms/InstCombine/shift-amount-reassociation-with-truncation-shl.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/InstCombine/shift-amount-reassociation-with-truncation-shl.ll b/llvm/test/Transforms/InstCombine/shift-amount-reassociation-with-truncation-shl.ll
index cbd5d66c6367..7b275ec42d33 100644
--- a/llvm/test/Transforms/InstCombine/shift-amount-reassociation-with-truncation-shl.ll
+++ b/llvm/test/Transforms/InstCombine/shift-amount-reassociation-with-truncation-shl.ll
@@ -260,3 +260,20 @@ cond.end:
   %eq = icmp eq i32 %cond, %conv27
   ret i1 %eq
 }
+
+
+define i16 @extra_use_on_first_shift(i32 %x) {
+; CHECK-LABEL: @extra_use_on_first_shift(
+; CHECK-NEXT:    [[A:%.*]] = ashr i32 [[X:%.*]], 3
+; CHECK-NEXT:    call void @use32(i32 [[A]])
+; CHECK-NEXT:    [[SH1:%.*]] = lshr i32 [[A]], 6
+; CHECK-NEXT:    [[TMP1:%.*]] = trunc i32 [[SH1]] to i16
+; CHECK-NEXT:    [[SH:%.*]] = and i16 [[TMP1]], 1023
+; CHECK-NEXT:    ret i16 [[SH]]
+;
+  %a = ashr i32 %x, 3
+  call void @use32(i32 %a)
+  %tr = trunc i32 %a to i16
+  %sh = lshr i16 %tr, 6
+  ret i16 %sh
+}


        


More information about the llvm-commits mailing list