[llvm] [IR] Implement filterDbgVars using make_isa_range (NFC) (PR #223964)

via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 16 03:22:16 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-ir

Author: Florian Hahn (fhahn)

<details>
<summary>Changes</summary>

Simplify filterDbgVars implementation using helper introduced in https://github.com/llvm/llvm-project/pull/223414.

---
Full diff: https://github.com/llvm/llvm-project/pull/223964.diff


1 Files Affected:

- (modified) llvm/include/llvm/IR/DebugProgramInstruction.h (+2-4) 


``````````diff
diff --git a/llvm/include/llvm/IR/DebugProgramInstruction.h b/llvm/include/llvm/IR/DebugProgramInstruction.h
index 1acb8838bc1fe..08cfcbed50f41 100644
--- a/llvm/include/llvm/IR/DebugProgramInstruction.h
+++ b/llvm/include/llvm/IR/DebugProgramInstruction.h
@@ -47,6 +47,7 @@
 #ifndef LLVM_IR_DEBUGPROGRAMINSTRUCTION_H
 #define LLVM_IR_DEBUGPROGRAMINSTRUCTION_H
 
+#include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/ilist.h"
 #include "llvm/ADT/ilist_node.h"
 #include "llvm/ADT/iterator.h"
@@ -568,10 +569,7 @@ class DbgVariableRecord : public DbgRecord, protected DebugValueUser {
 /// Filter the DbgRecord range to DbgVariableRecord types only and downcast.
 static inline auto
 filterDbgVars(iterator_range<simple_ilist<DbgRecord>::iterator> R) {
-  return map_range(
-      make_filter_range(R,
-                        [](DbgRecord &E) { return isa<DbgVariableRecord>(E); }),
-      [](DbgRecord &E) { return std::ref(cast<DbgVariableRecord>(E)); });
+  return make_isa_range<DbgVariableRecord>(R);
 }
 
 /// Per-instruction record of debug-info. If an Instruction is the position of

``````````

</details>


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


More information about the llvm-commits mailing list