From 50de4a2461752ff23c5b9c439daac4c9d8f3b044 Mon Sep 17 00:00:00 2001 From: "William S. Moses" Date: Mon, 18 Sep 2023 12:24:39 -0400 Subject: [PATCH] Fix analysis insertion of anything --- enzyme/Enzyme/TypeAnalysis/TypeTree.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/enzyme/Enzyme/TypeAnalysis/TypeTree.h b/enzyme/Enzyme/TypeAnalysis/TypeTree.h index 00e2d97a6fdc..bf31de9f8b9f 100644 --- a/enzyme/Enzyme/TypeAnalysis/TypeTree.h +++ b/enzyme/Enzyme/TypeAnalysis/TypeTree.h @@ -981,8 +981,12 @@ class TypeTree : public std::enable_shared_from_this { return false; // Inserting say a [0]:anything into a [-1]:Float - if (CT == BaseType::Anything) + if (CT == BaseType::Anything) { + // If both at same index, remove old index + if (newMoreGeneralThanOld) + toremove.insert(pair.first); continue; + } // Otherwise, inserting a non-equivalent pair into a more general // slot. This is invalid.