Skip to content
This repository was archived by the owner on Mar 28, 2020. It is now read-only.

Commit 9bde5fb

Browse files
committed
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@318543 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent f54bfed commit 9bde5fb

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

lib/CodeGen/MIRParser/MIRParser.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,7 @@ bool MIRParserImpl::parseRegisterInfo(PerFunctionMIParsingState &PFS,
441441

442442
if (StringRef(VReg.Class.Value).equals("_")) {
443443
Info.Kind = VRegInfo::GENERIC;
444+
Info.D.RegBank = nullptr;
444445
} else {
445446
const auto *RC = getRegClass(MF, VReg.Class.Value);
446447
if (RC) {

0 commit comments

Comments
 (0)