[PATCH] Fix crash in MachineLICM.cpp

Quentin Colombet via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 7 09:03:32 PDT 2016


Hi Zan Jyu,

Yep.

Do you have a test case to put with that?

Thanks,
-Quentin
> On Jun 7, 2016, at 12:25 AM, zan jyu Wong via llvm-commits <llvm-commits at lists.llvm.org> wrote:
> 
> 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;
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160607/48caad65/attachment.html>


More information about the llvm-commits mailing list