@@ -101,15 +101,22 @@ std::string cleanType(CensusKey const &opKey) {
101
101
102
102
using Score_t = std::unordered_map<CensusKey, TypeScore>;
103
103
104
- void recordEdgeScore (CensusKey const &from, CensusKey const &to, Score_t scores) {
104
+ void recordEdgeScore (CensusKey const &from, CensusKey const &to, Score_t scores, bool useCleanType = true ) {
105
105
auto const logKey = from + " -> " + to;
106
106
CNS_DEBUG_MSG (logKey, " begin" );
107
107
108
- scores.at (from).addOutType (cleanType (to));
109
- CNS_DEBUG (logKey, " Updated out score for '{}': {}" , from, scores.at (from).outScore ());
108
+ auto recordType = [&useCleanType](auto const &key) {
109
+ if (useCleanType) {
110
+ return cleanType (key);
111
+ }
112
+ return ops (key).type_ ;
113
+ };
114
+
115
+ scores.at (from).addOutType (recordType (to));
116
+ CNS_DEBUG (logKey, " Added type '{}'; Updated out score for '{}': {}" , recordType (to), from, scores.at (from).outScore ());
110
117
111
- scores.at (to).addInType (cleanType (from));
112
- CNS_DEBUG (logKey, " Updated in score for '{}': {}" , to, scores.at (to).inScore ());
118
+ scores.at (to).addInType (recordType (from));
119
+ CNS_DEBUG (logKey, " Added type '{}'; Updated in score for '{}': {}" , recordType (from) , to, scores.at (to).inScore ());
113
120
114
121
CNS_DEBUG_MSG (logKey, " end" );
115
122
}
@@ -149,9 +156,15 @@ inline void propagateGenericScore(CensusKey const &from, CensusKey const &to) {
149
156
}
150
157
151
158
bool hasReinterpretCast (CensusKey const &from, CensusKey const &to, DominatorData const &linkInfo) {
159
+ /*
152
160
if(isTransformThroughMember(linkInfo)) {
153
161
return false;
154
162
}
163
+ */
164
+
165
+ if (linkInfo.castKind () != " BitCast" ) {
166
+ return false ;
167
+ }
155
168
156
169
auto isRelevantNumber = [](auto const &op) {
157
170
return isNumeric (op.qn_ )
@@ -191,18 +204,18 @@ void scoreSummary(TypeSummary const &ts) {
191
204
192
205
if (!isTransformThroughMember (to.linkInfo ())) {
193
206
recordEdgeScore (ts.key (), to.key (), SummarizedGenericScores);
194
-
195
- // reinterpret
196
- if (hasReinterpretCast (ts.key (), to.key (), to.linkInfo ())) {
197
- recordEdgeScore (ts.key (), to.key (), SummarizedReinterpretScores);
198
- }
199
207
}
200
208
201
209
auto const &from = ops (ts.key ());
202
210
if (from.type_ == " void *" ) {
203
211
propagateGenericScore (ts.key (), to.key ());
204
212
}
205
213
214
+ // reinterpret
215
+ if (hasReinterpretCast (ts.key (), to.key (), to.linkInfo ())) {
216
+ recordEdgeScore (ts.key (), to.key (), SummarizedReinterpretScores, false );
217
+ }
218
+
206
219
scoreSummary (to);
207
220
208
221
}
0 commit comments