[llvm] IR: Avoid repeating assert condition in Value destructor (PR #136340)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 18 11:13:57 PDT 2025


https://github.com/arsenm created https://github.com/llvm/llvm-project/pull/136340

None

>From 279920422a18a30f8150b34d661a30fcaddfbace Mon Sep 17 00:00:00 2001
From: Matt Arsenault <Matthew.Arsenault at amd.com>
Date: Fri, 18 Apr 2025 20:13:18 +0200
Subject: [PATCH] IR: Avoid repeating assert condition in Value destructor

---
 llvm/lib/IR/Value.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/llvm/lib/IR/Value.cpp b/llvm/lib/IR/Value.cpp
index 6c52ced5f73b2..0eaf75b7bfaec 100644
--- a/llvm/lib/IR/Value.cpp
+++ b/llvm/lib/IR/Value.cpp
@@ -98,9 +98,10 @@ Value::~Value() {
     dbgs() << "While deleting: " << *VTy << " %" << getName() << "\n";
     for (auto *U : users())
       dbgs() << "Use still stuck around after Def is destroyed:" << *U << "\n";
+
+    llvm_unreachable("Uses remain when a value is destroyed!");
   }
 #endif
-  assert(materialized_use_empty() && "Uses remain when a value is destroyed!");
 
   // If this value is named, destroy the name.  This should not be in a symtab
   // at this point.



More information about the llvm-commits mailing list