[llvm] r199214 - Fix valgrind warning for gcc builds.
Patrik Hagglund
patrik.h.hagglund at ericsson.com
Tue Jan 14 06:09:00 PST 2014
Author: patha
Date: Tue Jan 14 08:09:00 2014
New Revision: 199214
URL: http://llvm.org/viewvc/llvm-project?rev=199214&view=rev
Log:
Fix valgrind warning for gcc builds.
Sorry, I don't understand why the warning is generated (a gcc
bug?). Anyhow, the change should improve readablity. No functionality
change intended.
Modified:
llvm/trunk/lib/CodeGen/RegisterCoalescer.cpp
Modified: llvm/trunk/lib/CodeGen/RegisterCoalescer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegisterCoalescer.cpp?rev=199214&r1=199213&r2=199214&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/RegisterCoalescer.cpp (original)
+++ llvm/trunk/lib/CodeGen/RegisterCoalescer.cpp Tue Jan 14 08:09:00 2014
@@ -816,18 +816,17 @@ bool RegisterCoalescer::reMaterializeTri
}
if (TargetRegisterInfo::isVirtualRegister(DstReg)) {
- unsigned NewIdx = NewMI->getOperand(0).getSubReg();
+ unsigned NewIdx;
const TargetRegisterClass *RCForInst;
- if (NewIdx)
- RCForInst = TRI->getMatchingSuperRegClass(MRI->getRegClass(DstReg), DefRC,
- NewIdx);
if (MRI->constrainRegClass(DstReg, DefRC)) {
// The materialized instruction is quite capable of setting DstReg
// directly, but it may still have a now-trivial subregister index which
// we should clear.
NewMI->getOperand(0).setSubReg(0);
- } else if (NewIdx && RCForInst) {
+ } else if ((NewIdx = NewMI->getOperand(0).getSubReg()) &&
+ (RCForInst = TRI->getMatchingSuperRegClass(
+ MRI->getRegClass(DstReg), DefRC, NewIdx))) {
// The subreg index on NewMI is essential; we still have to make sure
// DstReg:idx is in a class that NewMI can use.
MRI->constrainRegClass(DstReg, RCForInst);
More information about the llvm-commits
mailing list