MCPcopy Create free account
hub / github.com/Samsung/UTopia / MergeValues

Method MergeValues

lib/indcallsolver/CustomCVPPass.cpp:167–179  ·  view source on GitHub ↗

Merge the two given lattice values. The interesting cases are merging two FunctionSet values and a FunctionSet value with an Undefined value. For these cases, we simply union the function sets. If the size of the union is greater than the maximum functions we track, the merged value is overdefined. LLVM CVP has set overdefined if X or Y are overdefined when merging, but Custom CVP has set overdefi

Source from the content-addressed store, hash-verified

165 /// but Custom CVP has set overdefined when X and Y are overdefined.
166 /// Changed condition helps to keep track of more variables.
167 CVPLatticeVal MergeValues(CVPLatticeVal X, CVPLatticeVal Y) override {
168 if (X == getOverdefinedVal() && Y == getOverdefinedVal())
169 return getOverdefinedVal();
170 if (X == getUndefVal() && Y == getUndefVal())
171 return getUndefVal();
172 std::vector<Function *> Union;
173 std::set_union(X.getFunctions().begin(), X.getFunctions().end(),
174 Y.getFunctions().begin(), Y.getFunctions().end(),
175 std::back_inserter(Union), CVPLatticeVal::Compare{});
176 if (Union.size() > MaxFunctionsPerValue)
177 return getOverdefinedVal();
178 return CVPLatticeVal(std::move(Union));
179 }
180
181 /// Compute the lattice values that change as a result of executing the given
182 /// instruction. The changed values are stored in \p ChangedValues. We handle

Callers

nothing calls this directly

Calls 4

CVPLatticeValClass · 0.85
beginMethod · 0.80
endMethod · 0.80
sizeMethod · 0.80

Tested by

no test coverage detected