[GlobalISel] fix crash in IRTranslator, MachineIRBuilder when translating @llvm.dbg...
authorDominik Montada <dominik.montada@hightec-rt.com>
Fri, 27 Mar 2020 15:47:37 +0000 (16:47 +0100)
committerDominik Montada <dominik.montada@hightec-rt.com>
Thu, 11 Jun 2020 08:47:49 +0000 (10:47 +0200)
commitf24e2e9eebde4b7a1d10b11a2c0acd6fe9905712
tree8a5df7f0d5291c4371a21fe5fabb673613ac37b3
parente87e55edbc798c1c73963151f114df775b1ec460
[GlobalISel] fix crash in IRTranslator, MachineIRBuilder when translating @llvm.dbg.value intrinsic and using -debug

Summary:
Fix crash when using -debug caused by the GlobalISel observer trying to print
an incomplete DBG_VALUE instruction. This was caused by the MachineIRBuilder
using buildInstr, which immediately inserts the instruction causing print,
instead of using BuildMI to first build up the instruction and using
insertInstr when finished.

Add RUN-line to existing debug-insts.ll test with -debug flag set to make sure
no crash is happening.

Also fixed a missing %s in the 2nd RUN-line of the same test.

Reviewers: t.p.northover, aditya_nandakumar, aemerson, dsanders, arsenm

Reviewed By: arsenm

Subscribers: wdng, arsenm, rovka, hiraditya, volkan, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D76934
llvm/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp
llvm/test/CodeGen/AArch64/GlobalISel/debug-insts.ll