[llvm-commits] [llvm] r159236 - /llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp

Evan Cheng evan.cheng at apple.com
Tue Jun 26 15:54:59 PDT 2012


Author: evancheng
Date: Tue Jun 26 17:54:59 2012
New Revision: 159236

URL: http://llvm.org/viewvc/llvm-project?rev=159236&view=rev
Log:
Add a missing check to avoid dereference null. No sensible test case possible. Sorry. rdar://11745134

Modified:
    llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp

Modified: llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp?rev=159236&r1=159235&r2=159236&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp Tue Jun 26 17:54:59 2012
@@ -1802,6 +1802,8 @@
 bool ARMBaseInstrInfo::
 OptimizeCompareInstr(MachineInstr *CmpInstr, unsigned SrcReg, int CmpMask,
                      int CmpValue, const MachineRegisterInfo *MRI) const {
+  if (MRI->def_empty(SrcReg))
+    return false;
 
   MachineRegisterInfo::def_iterator DI = MRI->def_begin(SrcReg);
   if (llvm::next(DI) != MRI->def_end())





More information about the llvm-commits mailing list