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

via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 17 04:11:01 PDT 2026


Author: Florian Hahn
Date: 2026-09-17T11:10:55Z
New Revision: c9ccf236acd9c3ad1cf8791d52ca19cb5062d2a1

URL: https://github.com/llvm/llvm-project/commit/c9ccf236acd9c3ad1cf8791d52ca19cb5062d2a1
DIFF: https://github.com/llvm/llvm-project/commit/c9ccf236acd9c3ad1cf8791d52ca19cb5062d2a1.diff

LOG: [IR] Implement filterDbgVars using make_isa_range (NFC) (#223964)

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

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

Added: 
    

Modified: 
    llvm/include/llvm/IR/DebugProgramInstruction.h

Removed: 
    


################################################################################
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


        


More information about the llvm-commits mailing list