@@ -65,12 +65,9 @@ void Generalize(InstContext &IC, Solver *S, ParsedReplacement Input) {
6565}
6666
6767void SymbolizeAndGeneralize (InstContext &IC,
68- Solver *S, ParsedReplacement Input) {
69- std::vector<Inst *> LHSConsts, RHSConsts;
70- auto Pred = [](Inst *I) {return I->K == Inst::Const;};
71- findInsts (Input.Mapping .LHS , LHSConsts, Pred);
72- findInsts (Input.Mapping .RHS , RHSConsts, Pred);
73-
68+ Solver *S, ParsedReplacement Input,
69+ std::vector<Inst *> LHSConsts,
70+ std::vector<Inst *> RHSConsts) {
7471 if (RHSConsts.size () != 1 ) {
7572 return ;
7673 // TODO: Relax this restriction later
@@ -182,6 +179,23 @@ void SymbolizeAndGeneralize(InstContext &IC,
182179 }
183180}
184181
182+ void SymbolizeAndGeneralize (InstContext &IC,
183+ Solver *S, ParsedReplacement Input) {
184+ std::vector<Inst *> LHSConsts, RHSConsts;
185+ auto Pred = [](Inst *I) {return I->K == Inst::Const;};
186+ findInsts (Input.Mapping .LHS , LHSConsts, Pred);
187+ findInsts (Input.Mapping .RHS , RHSConsts, Pred);
188+ // One LHS const at a time
189+ for (auto LHSConst : LHSConsts) {
190+ SymbolizeAndGeneralize (IC, S, Input, {LHSConst}, RHSConsts);
191+ }
192+
193+ // All at once
194+ SymbolizeAndGeneralize (IC, S, Input, LHSConsts, RHSConsts);
195+
196+ // TODO Find other useful configurations
197+ }
198+
185199// TODO: Return modified instructions instead of just printing out
186200void RemoveLeafAndGeneralize (InstContext &IC,
187201 Solver *S, ParsedReplacement Input) {
0 commit comments