[PATCH] Fix crash in MachineLICM.cpp

zan jyu Wong via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 7 17:38:03 PDT 2016


No. Since I'm working on a custom backend, unless I upload the backend.
But there is an assertion in isDef(), so I think it can be reproduced on
other backend when compile with -sink-insts-to-avoid-spills=true.

On Wed, Jun 8, 2016 at 12:03 AM, Quentin Colombet <qcolombet at apple.com>
wrote:

> 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/20160608/f785db8f/attachment.html>


More information about the llvm-commits mailing list