@@ -260,8 +260,17 @@ void GISelCSEInfo::releaseMemory() {
260
260
#endif
261
261
}
262
262
263
+ #ifndef NDEBUG
264
+ static const char *stringify (const MachineInstr *MI, std::string &S) {
265
+ raw_string_ostream OS (S);
266
+ OS << *MI;
267
+ return OS.str ().c_str ();
268
+ }
269
+ #endif
270
+
263
271
Error GISelCSEInfo::verify () {
264
272
#ifndef NDEBUG
273
+ std::string S1, S2;
265
274
handleRecordedInsts ();
266
275
// For each instruction in map from MI -> UMI,
267
276
// Profile(MI) and make sure UMI is found for that profile.
@@ -274,19 +283,23 @@ Error GISelCSEInfo::verify() {
274
283
if (FoundNode != It.second )
275
284
return createStringError (std::errc::not_supported,
276
285
" CSEMap mismatch, InstrMapping has MIs without "
277
- " corresponding Nodes in CSEMap" );
286
+ " corresponding Nodes in CSEMap:\n %s" ,
287
+ stringify (It.second ->MI , S1));
278
288
}
279
289
280
290
// For every node in the CSEMap, make sure that the InstrMapping
281
291
// points to it.
282
292
for (const UniqueMachineInstr &UMI : CSEMap) {
283
293
if (!InstrMapping.count (UMI.MI ))
284
294
return createStringError (std::errc::not_supported,
285
- " Node in CSE without InstrMapping" , UMI.MI );
295
+ " Node in CSE without InstrMapping:\n %s" ,
296
+ stringify (UMI.MI , S1));
286
297
287
298
if (InstrMapping[UMI.MI ] != &UMI)
288
299
return createStringError (std::make_error_code (std::errc::not_supported),
289
- " Mismatch in CSE mapping" );
300
+ " Mismatch in CSE mapping:\n %s\n %s" ,
301
+ stringify (InstrMapping[UMI.MI ]->MI , S1),
302
+ stringify (UMI.MI , S2));
290
303
}
291
304
#endif
292
305
return Error::success ();
0 commit comments