aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
diff options
context:
space:
mode:
authorRahul Joshi <rjoshi@nvidia.com>2024-10-16 07:21:10 -0700
committerGitHub <noreply@github.com>2024-10-16 07:21:10 -0700
commit6924fc03260370876f7091ba06cdc350989ac3c5 (patch)
tree4cf2c376bef512f593eb6707be5a7aea6785050e /llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
parentcba7b369b2a511082897fc5dc5a9c95a36c2743d (diff)
downloadllvm-6924fc03260370876f7091ba06cdc350989ac3c5.zip
llvm-6924fc03260370876f7091ba06cdc350989ac3c5.tar.gz
llvm-6924fc03260370876f7091ba06cdc350989ac3c5.tar.bz2
[LLVM] Add `Intrinsic::getDeclarationIfExists` (#112428)
Add `Intrinsic::getDeclarationIfExists` to lookup an existing declaration of an intrinsic in a `Module`.
Diffstat (limited to 'llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp b/llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
index f3f5ffb..aa3cbc5 100644
--- a/llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
+++ b/llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
@@ -2920,8 +2920,8 @@ static bool collectUnswitchCandidates(
// Whether or not we should also collect guards in the loop.
bool CollectGuards = false;
if (UnswitchGuards) {
- auto *GuardDecl = L.getHeader()->getParent()->getParent()->getFunction(
- Intrinsic::getName(Intrinsic::experimental_guard));
+ auto *GuardDecl = Intrinsic::getDeclarationIfExists(
+ L.getHeader()->getParent()->getParent(), Intrinsic::experimental_guard);
if (GuardDecl && !GuardDecl->use_empty())
CollectGuards = true;
}