[clang] [clang][dataflow] Fix bug in `Value` comparison. (PR #76746)

Gábor Horváth via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 2 13:34:08 PST 2024


================
@@ -27,9 +27,13 @@ static bool areEquivalentIndirectionValues(const Value &Val1,
 }
 
 bool areEquivalentValues(const Value &Val1, const Value &Val2) {
-  return &Val1 == &Val2 || (Val1.getKind() == Val2.getKind() &&
-                            (isa<TopBoolValue>(&Val1) ||
-                             areEquivalentIndirectionValues(Val1, Val2)));
+  // If values are distinct and have properties, we don't consider them equal,
+  // leaving equality up to the user model.
+  return &Val1 == &Val2 ||
+         (Val1.getKind() == Val2.getKind() &&
+          (Val1.properties().empty() && Val2.properties().empty()) &&
----------------
Xazax-hun wrote:

Do we want to consider them different when only one of them has properties?

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


More information about the cfe-commits mailing list