1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 19:23:23 +01:00

MIRParser: Avoid reading uninitialized memory on generic vregs

If a vreg's bank is specified in the registers block and one of its
defs or uses also specifies the bank, we end up checking that the
RegBank is equal to diagnose conflicting banks. The problem comes up
for generic vregs, where we weren't fully initializing the VRegInfo
when parsing the registers block, so we'd end up comparing a null
pointer to uninitialized memory.

This fixes a non-deterministic failure when round tripping through MIR
with generic vregs.

llvm-svn: 318543
This commit is contained in:
Justin Bogner 2017-11-17 18:51:20 +00:00
parent b6532d9c64
commit 5fe832bb72

View File

@ -441,6 +441,7 @@ bool MIRParserImpl::parseRegisterInfo(PerFunctionMIParsingState &PFS,
if (StringRef(VReg.Class.Value).equals("_")) {
Info.Kind = VRegInfo::GENERIC;
Info.D.RegBank = nullptr;
} else {
const auto *RC = getRegClass(MF, VReg.Class.Value);
if (RC) {