In many places DebugLoc and PCSections metadata are just copied along to
propagate them through MachineInstrs. Simplify doing so by bundling them
up in a MIMetadata class that replaces the DebugLoc argument to most
BuildMI() variants.
The DebugLoc-only constructors allow implicit construction, so that
existing usage of BuildMI(.., DL, ..) works as before, and the rest of
the codebase using BuildMI() does not require changes.
NFC.
Depends on D130882
I don't insist, but you want to avoid such wrapping of EXPECTs into functions or lambdas.
When test fails it will not provide location of the failed line with CheckMI
If you want to reuse pair of checks,
EXPECT_EQ(MIB->getDebugLoc(), DL);
EXPECT_EQ(MIB->getPCSections(), PCS);
you can use EXPECT_THAT with custom matches
EXPECT_THAT(BuildMI(*MBB, MBB->end(), MIMD, MCID)(), MyMatches);
another alternative: