[llvm] Introduce CounterExpressionBuilder::replace(C, Map) (PR #112698)
Jessica Paquette via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 18 20:15:16 PST 2024
================
@@ -135,6 +135,38 @@ Counter CounterExpressionBuilder::subtract(Counter LHS, Counter RHS,
return Simplify ? simplify(Cnt) : Cnt;
}
+Counter CounterExpressionBuilder::replace(Counter C, const ReplaceMap &Map) {
+ auto I = Map.find(C);
+
+ // Replace C with the Map even if C is Expression.
+ if (I != Map.end())
+ return I->second;
+
+ // Traverse only Expression.
+ if (!C.isExpression())
+ return C;
+
+ auto CE = Expressions[C.getExpressionID()];
+ auto NewLHS = replace(CE.LHS, Map);
----------------
ornata wrote:
If we don't want a check, is it possible to add debug output?
https://github.com/llvm/llvm-project/pull/112698
More information about the llvm-commits
mailing list