From 70c68a6b0e515967dba5b30f6a60e220a8cd8d2c Mon Sep 17 00:00:00 2001 From: Philip Reames Date: Tue, 19 Nov 2019 14:43:13 -0800 Subject: [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. --- llvm/lib/Analysis/GuardUtils.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'llvm/lib/Analysis') 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()); } +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; -- cgit v1.2.3