summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/GuardUtils.cpp
diff options
context:
space:
mode:
authorPhilip Reames <listmail@philipreames.com>2019-11-19 14:43:13 -0800
committerPhilip Reames <listmail@philipreames.com>2019-11-19 14:43:13 -0800
commit70c68a6b0e515967dba5b30f6a60e220a8cd8d2c (patch)
tree23ec3ddaefb2ed5edc15e23376ecfb5d284ddd8a /llvm/lib/Analysis/GuardUtils.cpp
parentf3eb5dee5756876be0524c59c21478659eba8c4d (diff)
downloadbcm5719-llvm-70c68a6b0e515967dba5b30f6a60e220a8cd8d2c.tar.gz
bcm5719-llvm-70c68a6b0e515967dba5b30f6a60e220a8cd8d2c.zip
[NFC] Factor out utilities for manipulating widenable branches
With the widenable condition construct, we have the ability to reason about branches which can be 'widened' (i.e. made to fail more often). We've got a couple o transforms which leverage this. This patch just cleans up the API a bit. This is prep work for generalizing our definition of a widenable branch slightly. At the moment "br i1 (and A, wc()), ..." is considered widenable, but oddly, neither "br i1 (and wc(), B), ..." or "br i1 wc(), ..." is. That clearly needs addressed, so first, let's centralize the code in one place.
Diffstat (limited to 'llvm/lib/Analysis/GuardUtils.cpp')
-rw-r--r--llvm/lib/Analysis/GuardUtils.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/GuardUtils.cpp b/llvm/lib/Analysis/GuardUtils.cpp
index 863443cea35..6dc2b740ac9 100644
--- a/llvm/lib/Analysis/GuardUtils.cpp
+++ b/llvm/lib/Analysis/GuardUtils.cpp
@@ -19,6 +19,13 @@ bool llvm::isGuard(const User *U) {
return match(U, m_Intrinsic<Intrinsic::experimental_guard>());
}
+bool llvm::isWidenableBranch(const User *U) {
+ Value *Condition, *WidenableCondition;
+ BasicBlock *GuardedBB, *DeoptBB;
+ return parseWidenableBranch(U, Condition, WidenableCondition, GuardedBB,
+ DeoptBB);
+}
+
bool llvm::isGuardAsWidenableBranch(const User *U) {
Value *Condition, *WidenableCondition;
BasicBlock *GuardedBB, *DeoptBB;
OpenPOWER on IntegriCloud