[PATCH] D34737: [InstCombine] Remove 64-bit bit width restriction from m_ConstantInt(uint64_t*&)

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 28 11:07:45 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL306577: [InstCombine] Remove 64-bit bit width restriction from m_ConstantInt(uint64_t*&) (authored by ctopper).

Changed prior to commit:
  https://reviews.llvm.org/D34737?vs=104349&id=104470#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D34737

Files:
  llvm/trunk/include/llvm/IR/PatternMatch.h
  llvm/trunk/test/Transforms/InstCombine/icmp.ll


Index: llvm/trunk/include/llvm/IR/PatternMatch.h
===================================================================
--- llvm/trunk/include/llvm/IR/PatternMatch.h
+++ llvm/trunk/include/llvm/IR/PatternMatch.h
@@ -402,7 +402,7 @@
 
   template <typename ITy> bool match(ITy *V) {
     if (const auto *CV = dyn_cast<ConstantInt>(V))
-      if (CV->getBitWidth() <= 64) {
+      if (CV->getValue().ule(UINT64_MAX)) {
         VR = CV->getZExtValue();
         return true;
       }
Index: llvm/trunk/test/Transforms/InstCombine/icmp.ll
===================================================================
--- llvm/trunk/test/Transforms/InstCombine/icmp.ll
+++ llvm/trunk/test/Transforms/InstCombine/icmp.ll
@@ -762,16 +762,11 @@
   ret i1 %A
 }
 
-; TODO we have a 64-bit or less restriction in the handling for this pattern. We should remove that and do the same thing we do above.
 define i1 @test52b(i128 %x1) {
 ; CHECK-LABEL: @test52b(
-; CHECK-NEXT:    [[CONV:%.*]] = and i128 [[X1:%.*]], 255
-; CHECK-NEXT:    [[CMP:%.*]] = icmp eq i128 [[CONV]], 127
-; CHECK-NEXT:    [[TMP2:%.*]] = lshr i128 [[X1]], 16
-; CHECK-NEXT:    [[TMP3:%.*]] = trunc i128 [[TMP2]] to i8
-; CHECK-NEXT:    [[CMP15:%.*]] = icmp eq i8 [[TMP3]], 76
-; CHECK-NEXT:    [[A:%.*]] = and i1 [[CMP]], [[CMP15]]
-; CHECK-NEXT:    ret i1 [[A]]
+; CHECK-NEXT:    [[TMP1:%.*]] = and i128 [[X1:%.*]], 16711935
+; CHECK-NEXT:    [[TMP2:%.*]] = icmp eq i128 [[TMP1]], 4980863
+; CHECK-NEXT:    ret i1 [[TMP2]]
 ;
   %conv = and i128 %x1, 255
   %cmp = icmp eq i128 %conv, 127


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34737.104470.patch
Type: text/x-patch
Size: 1539 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170628/244515da/attachment.bin>


More information about the llvm-commits mailing list