summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorPatrik Hagglund <patrik.h.hagglund@ericsson.com>2014-01-14 14:09:00 +0000
committerPatrik Hagglund <patrik.h.hagglund@ericsson.com>2014-01-14 14:09:00 +0000
commit682a10d4cc324824bced72bdc40d2d8a9dbfaf96 (patch)
tree37fbb4d73e1de60070fb129c0cbfb5d059b32a3b /llvm/lib/CodeGen
parent5448a3c7717efab65f173070be6ce8270deb548e (diff)
downloadbcm5719-llvm-682a10d4cc324824bced72bdc40d2d8a9dbfaf96.tar.gz
bcm5719-llvm-682a10d4cc324824bced72bdc40d2d8a9dbfaf96.zip
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. llvm-svn: 199214
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/RegisterCoalescer.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/llvm/lib/CodeGen/RegisterCoalescer.cpp b/llvm/lib/CodeGen/RegisterCoalescer.cpp
index dd86c1f0103..efe7161e16f 100644
--- a/llvm/lib/CodeGen/RegisterCoalescer.cpp
+++ b/llvm/lib/CodeGen/RegisterCoalescer.cpp
@@ -816,18 +816,17 @@ bool RegisterCoalescer::reMaterializeTrivialDef(CoalescerPair &CP,
}
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);
OpenPOWER on IntegriCloud