[llvm] 8151c1b - Move implementation of isAssumeLikeIntrinsic into IntrinsicInst
Stanislav Mekhanoshin via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 11 11:41:44 PST 2021
Author: Stanislav Mekhanoshin
Date: 2021-02-11T11:41:34-08:00
New Revision: 8151c1b44211d5a7154ca860d28a6aed3a4f2715
URL: https://github.com/llvm/llvm-project/commit/8151c1b44211d5a7154ca860d28a6aed3a4f2715
DIFF: https://github.com/llvm/llvm-project/commit/8151c1b44211d5a7154ca860d28a6aed3a4f2715.diff
LOG: Move implementation of isAssumeLikeIntrinsic into IntrinsicInst
This is remove dependency on ValueTracking in the future patch.
Differential Revision: https://reviews.llvm.org/D96079
Added:
Modified:
llvm/include/llvm/IR/IntrinsicInst.h
llvm/lib/Analysis/ValueTracking.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/IR/IntrinsicInst.h b/llvm/include/llvm/IR/IntrinsicInst.h
index df3a1d568756..a7dec8837bf8 100644
--- a/llvm/include/llvm/IR/IntrinsicInst.h
+++ b/llvm/include/llvm/IR/IntrinsicInst.h
@@ -82,6 +82,29 @@ class IntrinsicInst : public CallInst {
}
}
+ // Checks if the intrinsic is an annotation.
+ bool isAssumeLikeIntrinsic() const {
+ switch (getIntrinsicID()) {
+ default: break;
+ case Intrinsic::assume:
+ case Intrinsic::sideeffect:
+ case Intrinsic::pseudoprobe:
+ case Intrinsic::dbg_declare:
+ case Intrinsic::dbg_value:
+ case Intrinsic::dbg_label:
+ case Intrinsic::invariant_start:
+ case Intrinsic::invariant_end:
+ case Intrinsic::lifetime_start:
+ case Intrinsic::lifetime_end:
+ case Intrinsic::experimental_noalias_scope_decl:
+ case Intrinsic::objectsize:
+ case Intrinsic::ptr_annotation:
+ case Intrinsic::var_annotation:
+ return true;
+ }
+ return false;
+ }
+
// Methods for support type inquiry through isa, cast, and dyn_cast:
static bool classof(const CallInst *I) {
if (const Function *CF = I->getCalledFunction())
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index 567d674ec721..d976d495e446 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -519,27 +519,8 @@ static bool isEphemeralValueOf(const Instruction *I, const Value *E) {
// Is this an intrinsic that cannot be speculated but also cannot trap?
bool llvm::isAssumeLikeIntrinsic(const Instruction *I) {
- if (const CallInst *CI = dyn_cast<CallInst>(I))
- if (Function *F = CI->getCalledFunction())
- switch (F->getIntrinsicID()) {
- default: break;
- // FIXME: This list is repeated from NoTTI::getIntrinsicCost.
- case Intrinsic::assume:
- case Intrinsic::sideeffect:
- case Intrinsic::pseudoprobe:
- case Intrinsic::dbg_declare:
- case Intrinsic::dbg_value:
- case Intrinsic::dbg_label:
- case Intrinsic::invariant_start:
- case Intrinsic::invariant_end:
- case Intrinsic::lifetime_start:
- case Intrinsic::lifetime_end:
- case Intrinsic::experimental_noalias_scope_decl:
- case Intrinsic::objectsize:
- case Intrinsic::ptr_annotation:
- case Intrinsic::var_annotation:
- return true;
- }
+ if (const IntrinsicInst *CI = dyn_cast<IntrinsicInst>(I))
+ return CI->isAssumeLikeIntrinsic();
return false;
}
More information about the llvm-commits
mailing list