@@ -349,31 +349,25 @@ TEST_F(InstrProfTest, test_merge_traces_sampled) {
349
349
IsSubsetOf ({FooTrace, BarTrace, GooTrace, BarTrace, GooTrace, FooTrace}));
350
350
}
351
351
352
+ using ::llvm::memprof::IndexedMemProfData;
352
353
using ::llvm::memprof::IndexedMemProfRecord;
353
354
using ::llvm::memprof::MemInfoBlock;
354
- using FrameIdMapTy =
355
- llvm::MapVector<::llvm::memprof::FrameId, ::llvm::memprof::Frame>;
356
- using CallStackIdMapTy =
357
- llvm::MapVector<::llvm::memprof::CallStackId,
358
- ::llvm::SmallVector<::llvm::memprof::FrameId>>;
359
-
360
- static FrameIdMapTy getFrameMapping () {
361
- FrameIdMapTy Mapping;
362
- Mapping.insert ({0 , {0x123 , 1 , 2 , false }});
363
- Mapping.insert ({1 , {0x345 , 3 , 4 , true }});
364
- Mapping.insert ({2 , {0x125 , 5 , 6 , false }});
365
- Mapping.insert ({3 , {0x567 , 7 , 8 , true }});
366
- Mapping.insert ({4 , {0x124 , 5 , 6 , false }});
367
- Mapping.insert ({5 , {0x789 , 8 , 9 , true }});
368
- return Mapping;
369
- }
370
355
371
- static CallStackIdMapTy getCallStackMapping () {
372
- CallStackIdMapTy Mapping;
373
- Mapping.insert ({0x111 , {0 , 1 }});
374
- Mapping.insert ({0x222 , {2 , 3 }});
375
- Mapping.insert ({0x333 , {4 , 5 }});
376
- return Mapping;
356
+ IndexedMemProfData getMemProfDataForTest () {
357
+ IndexedMemProfData MemProfData;
358
+
359
+ MemProfData.Frames .insert ({0 , {0x123 , 1 , 2 , false }});
360
+ MemProfData.Frames .insert ({1 , {0x345 , 3 , 4 , true }});
361
+ MemProfData.Frames .insert ({2 , {0x125 , 5 , 6 , false }});
362
+ MemProfData.Frames .insert ({3 , {0x567 , 7 , 8 , true }});
363
+ MemProfData.Frames .insert ({4 , {0x124 , 5 , 6 , false }});
364
+ MemProfData.Frames .insert ({5 , {0x789 , 8 , 9 , true }});
365
+
366
+ MemProfData.CallStacks .insert ({0x111 , {0 , 1 }});
367
+ MemProfData.CallStacks .insert ({0x222 , {2 , 3 }});
368
+ MemProfData.CallStacks .insert ({0x333 , {4 , 5 }});
369
+
370
+ return MemProfData;
377
371
}
378
372
379
373
// Populate all of the fields of MIB.
@@ -452,9 +446,7 @@ TEST_F(InstrProfTest, test_memprof_v2_full_schema) {
452
446
const IndexedMemProfRecord IndexedMR = makeRecordV2 (
453
447
/* AllocFrames=*/ {0x111 , 0x222 },
454
448
/* CallSiteFrames=*/ {0x333 }, MIB, memprof::getFullSchema ());
455
- memprof::IndexedMemProfData MemProfData;
456
- MemProfData.Frames = getFrameMapping ();
457
- MemProfData.CallStacks = getCallStackMapping ();
449
+ IndexedMemProfData MemProfData = getMemProfDataForTest ();
458
450
MemProfData.Records .try_emplace (0x9999 , IndexedMR);
459
451
Writer.addMemProfData (MemProfData, Err);
460
452
@@ -491,9 +483,7 @@ TEST_F(InstrProfTest, test_memprof_v2_partial_schema) {
491
483
const IndexedMemProfRecord IndexedMR = makeRecordV2 (
492
484
/* AllocFrames=*/ {0x111 , 0x222 },
493
485
/* CallSiteFrames=*/ {0x333 }, MIB, memprof::getHotColdSchema ());
494
- memprof::IndexedMemProfData MemProfData;
495
- MemProfData.Frames = getFrameMapping ();
496
- MemProfData.CallStacks = getCallStackMapping ();
486
+ IndexedMemProfData MemProfData = getMemProfDataForTest ();
497
487
MemProfData.Records .try_emplace (0x9999 , IndexedMR);
498
488
Writer.addMemProfData (MemProfData, Err);
499
489
@@ -602,9 +592,7 @@ TEST_F(InstrProfTest, test_memprof_merge) {
602
592
/* AllocFrames=*/ {0x111 , 0x222 },
603
593
/* CallSiteFrames=*/ {}, makePartialMIB (), memprof::getHotColdSchema ());
604
594
605
- memprof::IndexedMemProfData MemProfData;
606
- MemProfData.Frames = getFrameMapping ();
607
- MemProfData.CallStacks = getCallStackMapping ();
595
+ IndexedMemProfData MemProfData = getMemProfDataForTest ();
608
596
MemProfData.Records .try_emplace (0x9999 , IndexedMR);
609
597
Writer2.addMemProfData (MemProfData, Err);
610
598
0 commit comments