1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 10:42:39 +01:00

Fix initialization-order-fiasco error in "Add a heap alloc site marker field to the ExtraInfo in MachineInstrs"

This commit is contained in:
Amy Huang 2019-10-31 10:48:52 -07:00
parent e9d7161099
commit 3901f55911

View File

@ -139,11 +139,9 @@ private:
BogusSubtarget ST;
};
static MCAsmInfo AsmInfo = MCAsmInfo();
std::unique_ptr<MCContext> createMCContext() {
std::unique_ptr<MCContext> createMCContext(MCAsmInfo *AsmInfo) {
return std::make_unique<MCContext>(
&AsmInfo, nullptr, nullptr, nullptr, nullptr, false);
AsmInfo, nullptr, nullptr, nullptr, nullptr, false);
}
std::unique_ptr<BogusTargetMachine> createTargetMachine() {
@ -378,7 +376,8 @@ TEST(MachineInstrExtraInfo, AddExtraInfo) {
0, nullptr, nullptr, nullptr, 0, nullptr};
auto MI = MF->CreateMachineInstr(MCID, DebugLoc());
auto MC = createMCContext();
auto MAI = MCAsmInfo();
auto MC = createMCContext(&MAI);
auto MMO = MF->getMachineMemOperand(MachinePointerInfo(),
MachineMemOperand::MOLoad, 8, 8);
SmallVector<MachineMemOperand *, 2> MMOs;
@ -424,7 +423,8 @@ TEST(MachineInstrExtraInfo, ChangeExtraInfo) {
0, nullptr, nullptr, nullptr, 0, nullptr};
auto MI = MF->CreateMachineInstr(MCID, DebugLoc());
auto MC = createMCContext();
auto MAI = MCAsmInfo();
auto MC = createMCContext(&MAI);
auto MMO = MF->getMachineMemOperand(MachinePointerInfo(),
MachineMemOperand::MOLoad, 8, 8);
SmallVector<MachineMemOperand *, 2> MMOs;
@ -460,7 +460,8 @@ TEST(MachineInstrExtraInfo, RemoveExtraInfo) {
0, nullptr, nullptr, nullptr, 0, nullptr};
auto MI = MF->CreateMachineInstr(MCID, DebugLoc());
auto MC = createMCContext();
auto MAI = MCAsmInfo();
auto MC = createMCContext(&MAI);
auto MMO = MF->getMachineMemOperand(MachinePointerInfo(),
MachineMemOperand::MOLoad, 8, 8);
SmallVector<MachineMemOperand *, 2> MMOs;