[llvm] d004112 - [InstCombine] add shift of bool test with extra use; NFC

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 8 08:20:10 PDT 2021


Author: Sanjay Patel
Date: 2021-10-08T11:19:01-04:00
New Revision: d0041127495af7fd2c52532ed35efef125a2fe8b

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

LOG: [InstCombine] add shift of bool test with extra use; NFC

Added: 
    

Modified: 
    llvm/test/Transforms/InstCombine/lshr.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/InstCombine/lshr.ll b/llvm/test/Transforms/InstCombine/lshr.ll
index 2a7d8e18b6cb..571d86d059ae 100644
--- a/llvm/test/Transforms/InstCombine/lshr.ll
+++ b/llvm/test/Transforms/InstCombine/lshr.ll
@@ -172,6 +172,19 @@ define i16 @bool_zext(i1 %x) {
   ret i16 %hibit
 }
 
+define i32 @bool_zext_use(i1 %x) {
+; CHECK-LABEL: @bool_zext_use(
+; CHECK-NEXT:    [[SEXT:%.*]] = sext i1 [[X:%.*]] to i32
+; CHECK-NEXT:    call void @use(i32 [[SEXT]])
+; CHECK-NEXT:    [[HIBIT:%.*]] = zext i1 [[X]] to i32
+; CHECK-NEXT:    ret i32 [[HIBIT]]
+;
+  %sext = sext i1 %x to i32
+  call void @use(i32 %sext)
+  %hibit = lshr i32 %sext, 31
+  ret i32 %hibit
+}
+
 define <2 x i8> @bool_zext_splat(<2 x i1> %x) {
 ; CHECK-LABEL: @bool_zext_splat(
 ; CHECK-NEXT:    [[HIBIT:%.*]] = zext <2 x i1> [[X:%.*]] to <2 x i8>


        


More information about the llvm-commits mailing list