[PATCH] Fix crash in MachineLICM.cpp

zan jyu Wong via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 7 00:25:22 PDT 2016


We should test isReg() before isDef()

diff --git a/lib/CodeGen/MachineLICM.cpp b/lib/CodeGen/MachineLICM.cpp
index 00dec82..4ea0c56 100644
--- a/lib/CodeGen/MachineLICM.cpp
+++ b/lib/CodeGen/MachineLICM.cpp
@@ -716,7 +716,7 @@ void MachineLICM::SinkIntoLoop() {

   for (MachineInstr *I : Candidates) {
     const MachineOperand &MO = I->getOperand(0);
-    if (!MO.isDef() || !MO.isReg() || !MO.getReg())
+    if (!MO.isReg() || !MO.isDef() || !MO.getReg())
       continue;
     if (!MRI->hasOneDef(MO.getReg()))
       continue;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160607/6f28aece/attachment.html>


More information about the llvm-commits mailing list