[Lldb-commits] [flang] [llvm] [clang] [clang-tools-extra] [lld] [lldb] [libcxx] [openmp] [libc] [mlir] [CanonicalizeFreezeInLoops] fix duplicate removal (PR #74716)

2023-12-14 Thread Wei Tao via lldb-commits

https://github.com/Friedrich20 updated 
https://github.com/llvm/llvm-project/pull/74716

>From 5ef11803b597fec44b64239824a4c9d3280cfea6 Mon Sep 17 00:00:00 2001
From: Wei Tao 
Date: Thu, 7 Dec 2023 21:33:40 +0800
Subject: [PATCH] [LLVM][CanonicalizeFreezeInLoops] fix duplicate removal

---
 .../Transforms/Utils/CanonicalizeFreezeInLoops.cpp  | 13 ++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/llvm/lib/Transforms/Utils/CanonicalizeFreezeInLoops.cpp 
b/llvm/lib/Transforms/Utils/CanonicalizeFreezeInLoops.cpp
index fb4d8288537725..ff1eb17e0c2488 100644
--- a/llvm/lib/Transforms/Utils/CanonicalizeFreezeInLoops.cpp
+++ b/llvm/lib/Transforms/Utils/CanonicalizeFreezeInLoops.cpp
@@ -151,11 +151,18 @@ bool CanonicalizeFreezeInLoopsImpl::run() {
   }
 }
 
+bool Exist = false;
 auto Visit = [&](User *U) {
   if (auto *FI = dyn_cast(U)) {
-LLVM_DEBUG(dbgs() << "canonfr: found: " << *FI << "\n");
-Info.FI = FI;
-Candidates.push_back(Info);
+for (const auto &Candidate : Candidates) {
+  auto *FI_cand = Candidate.FI;
+  Exist = (FI_cand == FI) ? true : Exist;
+}
+if (!Exist) {
+  LLVM_DEBUG(dbgs() << "canonfr: found: " << *FI << "\n");
+  Info.FI = FI;
+  Candidates.push_back(Info);
+}
   }
 };
 for_each(PHI.users(), Visit);

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [flang] [llvm] [clang] [clang-tools-extra] [lld] [lldb] [libcxx] [openmp] [libc] [mlir] [CanonicalizeFreezeInLoops] fix duplicate removal (PR #74716)

2023-12-14 Thread Wei Tao via lldb-commits

https://github.com/Friedrich20 updated 
https://github.com/llvm/llvm-project/pull/74716

>From 5ef11803b597fec44b64239824a4c9d3280cfea6 Mon Sep 17 00:00:00 2001
From: Wei Tao 
Date: Thu, 7 Dec 2023 21:33:40 +0800
Subject: [PATCH] [LLVM][CanonicalizeFreezeInLoops] fix duplicate removal

---
 .../Transforms/Utils/CanonicalizeFreezeInLoops.cpp  | 13 ++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/llvm/lib/Transforms/Utils/CanonicalizeFreezeInLoops.cpp 
b/llvm/lib/Transforms/Utils/CanonicalizeFreezeInLoops.cpp
index fb4d8288537725..ff1eb17e0c2488 100644
--- a/llvm/lib/Transforms/Utils/CanonicalizeFreezeInLoops.cpp
+++ b/llvm/lib/Transforms/Utils/CanonicalizeFreezeInLoops.cpp
@@ -151,11 +151,18 @@ bool CanonicalizeFreezeInLoopsImpl::run() {
   }
 }
 
+bool Exist = false;
 auto Visit = [&](User *U) {
   if (auto *FI = dyn_cast(U)) {
-LLVM_DEBUG(dbgs() << "canonfr: found: " << *FI << "\n");
-Info.FI = FI;
-Candidates.push_back(Info);
+for (const auto &Candidate : Candidates) {
+  auto *FI_cand = Candidate.FI;
+  Exist = (FI_cand == FI) ? true : Exist;
+}
+if (!Exist) {
+  LLVM_DEBUG(dbgs() << "canonfr: found: " << *FI << "\n");
+  Info.FI = FI;
+  Candidates.push_back(Info);
+}
   }
 };
 for_each(PHI.users(), Visit);

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits