[llvm] r318543 - MIRParser: Avoid reading uninitialized memory on generic vregs
Justin Bogner via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 17 10:51:20 PST 2017
Author: bogner
Date: Fri Nov 17 10:51:20 2017
New Revision: 318543
URL: http://llvm.org/viewvc/llvm-project?rev=318543&view=rev
Log:
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.
Modified:
llvm/trunk/lib/CodeGen/MIRParser/MIRParser.cpp
Modified: llvm/trunk/lib/CodeGen/MIRParser/MIRParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MIRParser/MIRParser.cpp?rev=318543&r1=318542&r2=318543&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MIRParser/MIRParser.cpp (original)
+++ llvm/trunk/lib/CodeGen/MIRParser/MIRParser.cpp Fri Nov 17 10:51:20 2017
@@ -441,6 +441,7 @@ bool MIRParserImpl::parseRegisterInfo(Pe
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) {
More information about the llvm-commits
mailing list