[llvm] [RemoveDIs] Account for DPVAssigns in isIdenticalToWhenDefined (PR #82257)

Orlando Cazalet-Hyams via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 19 07:57:04 PST 2024


https://github.com/OCHyams created https://github.com/llvm/llvm-project/pull/82257

AddressExpression wasn't included in the comparison.

>From b867a2c052637d9768c7c608f6de9ad19cfab8a1 Mon Sep 17 00:00:00 2001
From: Orlando Cazalet-Hyams <orlando.hyams at sony.com>
Date: Mon, 19 Feb 2024 15:54:57 +0000
Subject: [PATCH] [RemoveDIs] Account for DPVAssigns in
 isIdenticalToWhenDefined

---
 llvm/include/llvm/IR/DebugProgramInstruction.h | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/llvm/include/llvm/IR/DebugProgramInstruction.h b/llvm/include/llvm/IR/DebugProgramInstruction.h
index a983280d2c4b9a..594f613aa8ed8b 100644
--- a/llvm/include/llvm/IR/DebugProgramInstruction.h
+++ b/llvm/include/llvm/IR/DebugProgramInstruction.h
@@ -271,16 +271,15 @@ class DPValue : public ilist_node<DPValue>, private DebugValueUser {
   std::optional<uint64_t> getFragmentSizeInBits() const;
 
   bool isEquivalentTo(const DPValue &Other) {
-    return std::tie(Type, DebugValues, Variable, Expression, DbgLoc) ==
-           std::tie(Other.Type, Other.DebugValues, Other.Variable,
-                    Other.Expression, Other.DbgLoc);
+    return DbgLoc == Other.DbgLoc && isIdenticalToWhenDefined(Other);
   }
   // Matches the definition of the Instruction version, equivalent to above but
   // without checking DbgLoc.
   bool isIdenticalToWhenDefined(const DPValue &Other) {
-    return std::tie(Type, DebugValues, Variable, Expression) ==
+    return std::tie(Type, DebugValues, Variable, Expression,
+                    AddressExpression) ==
            std::tie(Other.Type, Other.DebugValues, Other.Variable,
-                    Other.Expression);
+                    Other.Expression, Other.AddressExpression);
   }
 
   /// @name DbgAssign Methods



More information about the llvm-commits mailing list