[llvm] ebda066 - [InstCombine] add test for sdiv with shl; NFC

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 8 07:19:12 PDT 2022


Author: Sanjay Patel
Date: 2022-10-08T10:06:44-04:00
New Revision: ebda06686ffe002b24582f78551b3a2adda54d2a

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

LOG: [InstCombine] add test for sdiv with shl; NFC

Added: 
    

Modified: 
    llvm/test/Transforms/InstCombine/sdiv-exact-by-power-of-two.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/InstCombine/sdiv-exact-by-power-of-two.ll b/llvm/test/Transforms/InstCombine/sdiv-exact-by-power-of-two.ll
index 8bc29d04118be..6e30f877875d6 100644
--- a/llvm/test/Transforms/InstCombine/sdiv-exact-by-power-of-two.ll
+++ b/llvm/test/Transforms/InstCombine/sdiv-exact-by-power-of-two.ll
@@ -91,3 +91,14 @@ define i8 @shl1_nuw(i8 %x, i8 %y) {
   %div = sdiv exact i8 %x, %shl
   ret i8 %div
 }
+
+define i8 @shl1_nsw_not_exact(i8 %x, i8 %y) {
+; CHECK-LABEL: @shl1_nsw_not_exact(
+; CHECK-NEXT:    [[SHL:%.*]] = shl nuw nsw i8 1, [[Y:%.*]]
+; CHECK-NEXT:    [[DIV:%.*]] = sdiv i8 [[X:%.*]], [[SHL]]
+; CHECK-NEXT:    ret i8 [[DIV]]
+;
+  %shl = shl nsw i8 1, %y
+  %div = sdiv i8 %x, %shl
+  ret i8 %div
+}


        


More information about the llvm-commits mailing list