]> granicus.if.org Git - llvm/commitdiff
[PatternMatch] Remove 64-bit or less restriction from m_SpecificInt
authorCraig Topper <craig.topper@gmail.com>
Tue, 27 Jun 2017 15:39:40 +0000 (15:39 +0000)
committerCraig Topper <craig.topper@gmail.com>
Tue, 27 Jun 2017 15:39:40 +0000 (15:39 +0000)
Not sure why this restriction existed, but it seems like we should support any size Constant here.

The particular pattern in the tests is not the only use of this matcher in the tree. There's one in CodeGenPrepare and one in InstSimplify as well.

Differential Revision: https://reviews.llvm.org/D34666

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306417 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/IR/PatternMatch.h
test/Transforms/InstCombine/select-cmp-cttz-ctlz.ll

index 9e9c8ac75d2a8b0454f897a9db9ac524b1856fb4..4015e445097c0e74e2f9eb77ded69ba03249649b 100644 (file)
@@ -399,10 +399,7 @@ struct specific_intval {
       if (const auto *C = dyn_cast<Constant>(V))
         CI = dyn_cast_or_null<ConstantInt>(C->getSplatValue());
 
-    if (CI && CI->getBitWidth() <= 64)
-      return CI->getZExtValue() == Val;
-
-    return false;
+    return CI && CI->getValue() == Val;
   }
 };
 
index c5547acdc8c86974e01885159a25da27d7c60e1b..3ac02795b4786857060aa8d0bae032168ba3509e 100644 (file)
@@ -320,10 +320,8 @@ entry:
 
 define i128 @test7(i128 %x) {
 ; CHECK-LABEL: @test7(
-; CHECK-NEXT:    [[TMP0:%.*]] = tail call i128 @llvm.ctlz.i128(i128 [[X:%.*]], i1 true), !range !3
-; CHECK-NEXT:    [[TOBOOL:%.*]] = icmp ne i128 [[X]], 0
-; CHECK-NEXT:    [[COND:%.*]] = select i1 [[TOBOOL]], i128 [[TMP0]], i128 128
-; CHECK-NEXT:    ret i128 [[COND]]
+; CHECK-NEXT:    [[TMP1:%.*]] = tail call i128 @llvm.ctlz.i128(i128 [[X:%.*]], i1 false), !range !3
+; CHECK-NEXT:    ret i128 [[TMP1]]
 ;
   %1 = tail call i128 @llvm.ctlz.i128(i128 %x, i1 true)
   %tobool = icmp ne i128 %x, 0
@@ -333,10 +331,8 @@ define i128 @test7(i128 %x) {
 
 define i128 @test8(i128 %x) {
 ; CHECK-LABEL: @test8(
-; CHECK-NEXT:    [[TMP0:%.*]] = tail call i128 @llvm.cttz.i128(i128 [[X:%.*]], i1 true), !range !3
-; CHECK-NEXT:    [[TOBOOL:%.*]] = icmp ne i128 [[X]], 0
-; CHECK-NEXT:    [[COND:%.*]] = select i1 [[TOBOOL]], i128 [[TMP0]], i128 128
-; CHECK-NEXT:    ret i128 [[COND]]
+; CHECK-NEXT:    [[TMP1:%.*]] = tail call i128 @llvm.cttz.i128(i128 [[X:%.*]], i1 false), !range !3
+; CHECK-NEXT:    ret i128 [[TMP1]]
 ;
   %1 = tail call i128 @llvm.cttz.i128(i128 %x, i1 true)
   %tobool = icmp ne i128 %x, 0