summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/include/llvm/IR/PatternMatch.h2
-rw-r--r--llvm/test/Transforms/InstCombine/icmp.ll11
2 files changed, 4 insertions, 9 deletions
diff --git a/llvm/include/llvm/IR/PatternMatch.h b/llvm/include/llvm/IR/PatternMatch.h
index 6f6d28602d7..0450876c467 100644
--- a/llvm/include/llvm/IR/PatternMatch.h
+++ b/llvm/include/llvm/IR/PatternMatch.h
@@ -402,7 +402,7 @@ struct bind_const_intval_ty {
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;
}
diff --git a/llvm/test/Transforms/InstCombine/icmp.ll b/llvm/test/Transforms/InstCombine/icmp.ll
index 03a9f527555..b12ee917a82 100644
--- a/llvm/test/Transforms/InstCombine/icmp.ll
+++ b/llvm/test/Transforms/InstCombine/icmp.ll
@@ -762,16 +762,11 @@ define i1 @test52(i32 %x1) {
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
OpenPOWER on IntegriCloud