[llvm-dev] BuildMI crashes on a certain probability on the exact same test
Xiaochu Liu via llvm-dev
llvm-dev at lists.llvm.org
Sun Nov 22 17:59:32 PST 2015
Yes, it is this problem. I use
BuildMI(&MBB, MI->getDebugLoc(), TII->get(Vanilla::MOV),
MI->getOperand(0).getReg()).addReg(Vanilla::R1);
for the case and it works now...
On Sun, Nov 22, 2015 at 5:30 PM, Xiaochu Liu <xiaochu1122 at gmail.com> wrote:
> Thanks, Tim! I pulled the latest code from llvm master and it seems to
> be working now... I will try your suggestion after it crashes again.
>
> On Sun, Nov 22, 2015 at 2:57 PM, Tim Northover <t.p.northover at gmail.com> wrote:
>> On 22 November 2015 at 14:42, Xiaochu Liu via llvm-dev
>> <llvm-dev at lists.llvm.org> wrote:
>>> 14 clang 0x000000010e1bcb4d llvm::DebugLoc::DebugLoc(llvm::DebugLoc const&) + 29
>>>
>>> And the most strange thing is that this error does not happen
>>> everytime for the same test (it happens under certain probability) ?!
>>> Can anyone please show me some hints on how to debug this problem?
>>
>> My best guess is that I == MBB.end(), in which case there is no
>> MachineInstr behind it and I->getDebugLoc() is accessing random memory
>> that may or may not resemble a MachineInstr. Try asserting it's valid
>> just before the BuildMI, or just stepping through in a debugger.
>>
>> Cheers.
>>
>> Tim.
More information about the llvm-dev
mailing list