[llvm] [TypePromotion] Use return value from SmallPtrSet::insert to avoid a call to SmallPtrSet::count. NFC (PR #103008)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 12 23:24:03 PDT 2024
https://github.com/topperc created https://github.com/llvm/llvm-project/pull/103008
None
>From 04809c92ad8df07f913c092c6c8663855f09f4a5 Mon Sep 17 00:00:00 2001
From: Craig Topper <craig.topper at sifive.com>
Date: Mon, 12 Aug 2024 23:20:19 -0700
Subject: [PATCH] [TypePromotion] Use return value from SmallPtrSet::insert to
avoid a call to count. NFC
---
llvm/lib/CodeGen/TypePromotion.cpp | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/llvm/lib/CodeGen/TypePromotion.cpp b/llvm/lib/CodeGen/TypePromotion.cpp
index 0940759ddc421f..11aa3abe906853 100644
--- a/llvm/lib/CodeGen/TypePromotion.cpp
+++ b/llvm/lib/CodeGen/TypePromotion.cpp
@@ -834,11 +834,10 @@ bool TypePromotionImpl::TryToPromote(Value *V, unsigned PromotedWidth,
// the tree has already been explored.
// TODO: This could limit the transform, ie if we try to promote something
// from an i8 and fail first, before trying an i16.
- if (AllVisited.count(V))
+ if (!AllVisited.insert(V).second)
return false;
CurrentVisited.insert(V);
- AllVisited.insert(V);
// Calls can be both sources and sinks.
if (isSink(V))
More information about the llvm-commits
mailing list