[llvm] r306417 - [PatternMatch] Remove 64-bit or less restriction from m_SpecificInt
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 27 08:39:40 PDT 2017
Author: ctopper
Date: Tue Jun 27 08:39:40 2017
New Revision: 306417
URL: http://llvm.org/viewvc/llvm-project?rev=306417&view=rev
Log:
[PatternMatch] Remove 64-bit or less restriction from m_SpecificInt
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
Modified:
llvm/trunk/include/llvm/IR/PatternMatch.h
llvm/trunk/test/Transforms/InstCombine/select-cmp-cttz-ctlz.ll
Modified: llvm/trunk/include/llvm/IR/PatternMatch.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/PatternMatch.h?rev=306417&r1=306416&r2=306417&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/PatternMatch.h (original)
+++ llvm/trunk/include/llvm/IR/PatternMatch.h Tue Jun 27 08:39:40 2017
@@ -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;
}
};
Modified: llvm/trunk/test/Transforms/InstCombine/select-cmp-cttz-ctlz.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/select-cmp-cttz-ctlz.ll?rev=306417&r1=306416&r2=306417&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/select-cmp-cttz-ctlz.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/select-cmp-cttz-ctlz.ll Tue Jun 27 08:39:40 2017
@@ -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
More information about the llvm-commits
mailing list