@@ -1271,112 +1271,3 @@ fn visit_mir_and_promoted<'tcx, V: MirVisitor<'tcx>>(mut visitor: V, mir: &mir::
1271
1271
visitor. visit_mir ( promoted) ;
1272
1272
}
1273
1273
}
1274
-
1275
- #[ derive( Debug , Clone , Copy , PartialEq , Eq , Hash ) ]
1276
- pub enum TransItemState {
1277
- PredictedAndGenerated ,
1278
- PredictedButNotGenerated ,
1279
- NotPredictedButGenerated ,
1280
- }
1281
-
1282
- pub fn collecting_debug_information ( scx : & SharedCrateContext ) -> bool {
1283
- return cfg ! ( debug_assertions) &&
1284
- scx. sess ( ) . opts . debugging_opts . print_trans_items . is_some ( ) ;
1285
- }
1286
-
1287
- pub fn print_collection_results < ' a , ' tcx > ( scx : & SharedCrateContext < ' a , ' tcx > ) {
1288
- use std:: hash:: { Hash , SipHasher , Hasher } ;
1289
-
1290
- if !collecting_debug_information ( scx) {
1291
- return ;
1292
- }
1293
-
1294
- fn hash < T : Hash > ( t : & T ) -> u64 {
1295
- let mut s = SipHasher :: new ( ) ;
1296
- t. hash ( & mut s) ;
1297
- s. finish ( )
1298
- }
1299
-
1300
- let trans_items = scx. translation_items ( ) . borrow ( ) ;
1301
-
1302
- {
1303
- // Check for duplicate item keys
1304
- let mut item_keys = FnvHashMap ( ) ;
1305
-
1306
- for ( item, item_state) in trans_items. iter ( ) {
1307
- let k = item. to_string ( scx. tcx ( ) ) ;
1308
-
1309
- if item_keys. contains_key ( & k) {
1310
- let prev: ( TransItem , TransItemState ) = item_keys[ & k] ;
1311
- debug ! ( "DUPLICATE KEY: {}" , k) ;
1312
- debug ! ( " (1) {:?}, {:?}, hash: {}, raw: {}" ,
1313
- prev. 0 ,
1314
- prev. 1 ,
1315
- hash( & prev. 0 ) ,
1316
- prev. 0 . to_raw_string( ) ) ;
1317
-
1318
- debug ! ( " (2) {:?}, {:?}, hash: {}, raw: {}" ,
1319
- * item,
1320
- * item_state,
1321
- hash( item) ,
1322
- item. to_raw_string( ) ) ;
1323
- } else {
1324
- item_keys. insert ( k, ( * item, * item_state) ) ;
1325
- }
1326
- }
1327
- }
1328
-
1329
- let mut predicted_but_not_generated = FnvHashSet ( ) ;
1330
- let mut not_predicted_but_generated = FnvHashSet ( ) ;
1331
- let mut predicted = FnvHashSet ( ) ;
1332
- let mut generated = FnvHashSet ( ) ;
1333
-
1334
- for ( item, item_state) in trans_items. iter ( ) {
1335
- let item_key = item. to_string ( scx. tcx ( ) ) ;
1336
-
1337
- match * item_state {
1338
- TransItemState :: PredictedAndGenerated => {
1339
- predicted. insert ( item_key. clone ( ) ) ;
1340
- generated. insert ( item_key) ;
1341
- }
1342
- TransItemState :: PredictedButNotGenerated => {
1343
- predicted_but_not_generated. insert ( item_key. clone ( ) ) ;
1344
- predicted. insert ( item_key) ;
1345
- }
1346
- TransItemState :: NotPredictedButGenerated => {
1347
- not_predicted_but_generated. insert ( item_key. clone ( ) ) ;
1348
- generated. insert ( item_key) ;
1349
- }
1350
- }
1351
- }
1352
-
1353
- debug ! ( "Total number of translation items predicted: {}" , predicted. len( ) ) ;
1354
- debug ! ( "Total number of translation items generated: {}" , generated. len( ) ) ;
1355
- debug ! ( "Total number of translation items predicted but not generated: {}" ,
1356
- predicted_but_not_generated. len( ) ) ;
1357
- debug ! ( "Total number of translation items not predicted but generated: {}" ,
1358
- not_predicted_but_generated. len( ) ) ;
1359
-
1360
- if generated. len ( ) > 0 {
1361
- debug ! ( "Failed to predict {}% of translation items" ,
1362
- ( 100 * not_predicted_but_generated. len( ) ) / generated. len( ) ) ;
1363
- }
1364
- if generated. len ( ) > 0 {
1365
- debug ! ( "Predict {}% too many translation items" ,
1366
- ( 100 * predicted_but_not_generated. len( ) ) / generated. len( ) ) ;
1367
- }
1368
-
1369
- debug ! ( "" ) ;
1370
- debug ! ( "Not predicted but generated:" ) ;
1371
- debug ! ( "============================" ) ;
1372
- for item in not_predicted_but_generated {
1373
- debug ! ( " - {}" , item) ;
1374
- }
1375
-
1376
- debug ! ( "" ) ;
1377
- debug ! ( "Predicted but not generated:" ) ;
1378
- debug ! ( "============================" ) ;
1379
- for item in predicted_but_not_generated {
1380
- debug ! ( " - {}" , item) ;
1381
- }
1382
- }
0 commit comments