aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/ValueTracking.cpp
diff options
context:
space:
mode:
authorYingwei Zheng <dtcxzyw2333@gmail.com>2024-07-29 10:04:06 +0800
committerGitHub <noreply@github.com>2024-07-29 10:04:06 +0800
commit62e9f40949ddc52e9660b25ab146bd5d9b39ad88 (patch)
treee4c5129bfdaec57454d3b80f9082f986b8bd82f2 /llvm/lib/Analysis/ValueTracking.cpp
parent378fe2fc23fa56181577d411fe6d51fa531cd860 (diff)
downloadllvm-62e9f40949ddc52e9660b25ab146bd5d9b39ad88.zip
llvm-62e9f40949ddc52e9660b25ab146bd5d9b39ad88.tar.gz
llvm-62e9f40949ddc52e9660b25ab146bd5d9b39ad88.tar.bz2
[PatternMatch] Use `m_SpecificCmp` matchers. NFC. (#100878)
Compile-time improvement: http://llvm-compile-time-tracker.com/compare.php?from=13996378d81c8fa9a364aeaafd7382abbc1db83a&to=861ffa4ec5f7bde5a194a7715593a1b5359eb581&stat=instructions:u baseline: 803eaf29267c6aae9162d1a83a4a2ae508b440d3 ``` Top 5 improvements: stockfish/movegen.ll 2541620819 2538599412 -0.12% minetest/profiler.cpp.ll 431724935 431246500 -0.11% abc/luckySwap.c.ll 581173720 580581935 -0.10% abc/kitTruth.c.ll 2521936288 2519445570 -0.10% abc/extraUtilTruth.c.ll 1216674614 1215495502 -0.10% Top 5 regressions: openssl/libcrypto-shlib-sm4.ll 1155054721 1155943201 +0.08% openssl/libcrypto-lib-sm4.ll 1155054838 1155943063 +0.08% spike/vsm4r_vv.ll 1296430080 1297039258 +0.05% spike/vsm4r_vs.ll 1312496906 1313093460 +0.05% nuttx/lib_rand48.c.ll 126201233 126246692 +0.04% Overall: -0.02112308% ```
Diffstat (limited to 'llvm/lib/Analysis/ValueTracking.cpp')
-rw-r--r--llvm/lib/Analysis/ValueTracking.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index bfd26fa..10884f8 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -254,8 +254,7 @@ bool llvm::haveNoCommonBitsSet(const WithCache<const Value *> &LHSCache,
bool llvm::isOnlyUsedInZeroComparison(const Instruction *I) {
return !I->user_empty() && all_of(I->users(), [](const User *U) {
- ICmpInst::Predicate P;
- return match(U, m_ICmp(P, m_Value(), m_Zero()));
+ return match(U, m_ICmp(m_Value(), m_Zero()));
});
}
@@ -2594,10 +2593,10 @@ static bool isNonZeroRecurrence(const PHINode *PN) {
}
static bool matchOpWithOpEqZero(Value *Op0, Value *Op1) {
- ICmpInst::Predicate Pred;
- return (match(Op0, m_ZExtOrSExt(m_ICmp(Pred, m_Specific(Op1), m_Zero()))) ||
- match(Op1, m_ZExtOrSExt(m_ICmp(Pred, m_Specific(Op0), m_Zero())))) &&
- Pred == ICmpInst::ICMP_EQ;
+ return match(Op0, m_ZExtOrSExt(m_SpecificICmp(ICmpInst::ICMP_EQ,
+ m_Specific(Op1), m_Zero()))) ||
+ match(Op1, m_ZExtOrSExt(m_SpecificICmp(ICmpInst::ICMP_EQ,
+ m_Specific(Op0), m_Zero())));
}
static bool isNonZeroAdd(const APInt &DemandedElts, unsigned Depth,