aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/Value.cpp
diff options
context:
space:
mode:
authorTyker <tyker1@outlook.com>2020-06-15 10:57:17 +0200
committerTyker <tyker1@outlook.com>2020-06-16 13:12:35 +0200
commit90c50cad1983c5e29107a78382dead0fe2a9562c (patch)
tree331b2424a6da7c0cc44386883befeb21f009bc8c /llvm/lib/IR/Value.cpp
parent740575dc232b25de0a4bedb41e825ee2e5a056ea (diff)
downloadllvm-90c50cad1983c5e29107a78382dead0fe2a9562c.zip
llvm-90c50cad1983c5e29107a78382dead0fe2a9562c.tar.gz
llvm-90c50cad1983c5e29107a78382dead0fe2a9562c.tar.bz2
[AssumeBundles] add cannonicalisation to the assume builder
Summary: this reduces significantly the number of assumes generated without aftecting too much the information that is preserved. this improves the compile-time cost of enable-knowledge-retention significantly. Reviewers: jdoerfert, sstefan1 Reviewed By: jdoerfert Subscribers: hiraditya, asbirlea, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D79650
Diffstat (limited to 'llvm/lib/IR/Value.cpp')
-rw-r--r--llvm/lib/IR/Value.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/llvm/lib/IR/Value.cpp b/llvm/lib/IR/Value.cpp
index 70d4012..78c12f4 100644
--- a/llvm/lib/IR/Value.cpp
+++ b/llvm/lib/IR/Value.cpp
@@ -516,7 +516,9 @@ enum PointerStripKind {
};
template <PointerStripKind StripKind>
-static const Value *stripPointerCastsAndOffsets(const Value *V) {
+static const Value *stripPointerCastsAndOffsets(
+ const Value *V,
+ function_ref<void(const Value *)> Func = [](const Value *) {}) {
if (!V->getType()->isPointerTy())
return V;
@@ -526,6 +528,7 @@ static const Value *stripPointerCastsAndOffsets(const Value *V) {
Visited.insert(V);
do {
+ Func(V);
if (auto *GEP = dyn_cast<GEPOperator>(V)) {
switch (StripKind) {
case PSK_ZeroIndices:
@@ -667,8 +670,9 @@ const Value *Value::stripAndAccumulateConstantOffsets(
return V;
}
-const Value *Value::stripInBoundsOffsets() const {
- return stripPointerCastsAndOffsets<PSK_InBounds>(this);
+const Value *
+Value::stripInBoundsOffsets(function_ref<void(const Value *)> Func) const {
+ return stripPointerCastsAndOffsets<PSK_InBounds>(this, Func);
}
uint64_t Value::getPointerDereferenceableBytes(const DataLayout &DL,