[PATCH] Fix crash in MachineLICM.cpp

Quentin Colombet via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 7 17:50:19 PDT 2016


Could you try a simple example with that flag on x86_64 to produce a test case?

Thanks,
Q.
> On Jun 7, 2016, at 5:38 PM, zan jyu Wong <zyfwong at gmail.com> wrote:
> 
> 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 <mailto: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 <mailto: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 <mailto:llvm-commits at lists.llvm.org>
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits <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/b9f2ea91/attachment.html>


More information about the llvm-commits mailing list