[llvm] [CanonicalizeFreezeInLoops] fix duplicate removal (PR #74716)

Wei Tao via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 20 02:03:52 PST 2023


================
@@ -151,11 +151,18 @@ bool CanonicalizeFreezeInLoopsImpl::run() {
       }
     }
 
+    bool Exist = false;
     auto Visit = [&](User *U) {
       if (auto *FI = dyn_cast<FreezeInst>(U)) {
-        LLVM_DEBUG(dbgs() << "canonfr: found: " << *FI << "\n");
-        Info.FI = FI;
-        Candidates.push_back(Info);
+        for (const auto &Candidate : Candidates) {
----------------
Friedrich20 wrote:

The fix has been refactored by using SmallSetVector.
Thanks for the example that really helps a lot!

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


More information about the llvm-commits mailing list