aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/User.cpp
diff options
context:
space:
mode:
authorTyker <tyker1@outlook.com>2020-03-12 00:39:05 +0100
committerTyker <tyker1@outlook.com>2020-03-12 10:10:22 +0100
commitf16f139db40e6bf6462ca831eb1ec423c50aeef2 (patch)
treeffae5bfa957f78f21faba99010f0c7b0365c7e6d /llvm/lib/IR/User.cpp
parent61211fec864917cfc24988c21853d19747e6a1e4 (diff)
downloadllvm-f16f139db40e6bf6462ca831eb1ec423c50aeef2.zip
llvm-f16f139db40e6bf6462ca831eb1ec423c50aeef2.tar.gz
llvm-f16f139db40e6bf6462ca831eb1ec423c50aeef2.tar.bz2
Basis of dropping uses in llvm.assume.
Summary: This patch adds the basic utilities to deal with dropable uses. dropable uses are uses that we rather drop than prevent transformations, for now they are limited to uses in llvm.assume. Reviewers: jdoerfert, sstefan1 Reviewed By: jdoerfert Subscribers: uenoku, lebedev.ri, mgorny, hiraditya, dexonsmith, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D73404
Diffstat (limited to 'llvm/lib/IR/User.cpp')
-rw-r--r--llvm/lib/IR/User.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/IR/User.cpp b/llvm/lib/IR/User.cpp
index 4a3eba9..3097916 100644
--- a/llvm/lib/IR/User.cpp
+++ b/llvm/lib/IR/User.cpp
@@ -9,6 +9,7 @@
#include "llvm/IR/User.h"
#include "llvm/IR/Constant.h"
#include "llvm/IR/GlobalValue.h"
+#include "llvm/IR/IntrinsicInst.h"
namespace llvm {
class BasicBlock;
@@ -105,6 +106,12 @@ MutableArrayRef<uint8_t> User::getDescriptor() {
reinterpret_cast<uint8_t *>(DI) - DI->SizeInBytes, DI->SizeInBytes);
}
+bool User::isDroppable() const {
+ if (const auto *Intr = dyn_cast<IntrinsicInst>(this))
+ return Intr->getIntrinsicID() == Intrinsic::assume;
+ return false;
+}
+
//===----------------------------------------------------------------------===//
// User operator new Implementations
//===----------------------------------------------------------------------===//