forked from OSchip/llvm-project
AMDGPU: Verify instructions in non-debug builds as well
And emit an error if it fails. This prevents illegal instructions from getting sent to the GPU, which would potentially result in a hang. This is a candidate for the stable branch(es). Reviewed-by: Marek Olšák <marek.olsak@amd.com> llvm-svn: 263627
This commit is contained in:
parent
beb79ceb19
commit
302f83ac4e
|
@ -88,13 +88,13 @@ void AMDGPUAsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
|||
const AMDGPUSubtarget &STI = MF->getSubtarget<AMDGPUSubtarget>();
|
||||
AMDGPUMCInstLower MCInstLowering(OutContext, STI);
|
||||
|
||||
#ifdef _DEBUG
|
||||
StringRef Err;
|
||||
if (!STI.getInstrInfo()->verifyInstruction(MI, Err)) {
|
||||
errs() << "Warning: Illegal instruction detected: " << Err << "\n";
|
||||
LLVMContext &C = MI->getParent()->getParent()->getFunction()->getContext();
|
||||
C.emitError("Illegal instruction detected: " + Err);
|
||||
MI->dump();
|
||||
}
|
||||
#endif
|
||||
|
||||
if (MI->isBundle()) {
|
||||
const MachineBasicBlock *MBB = MI->getParent();
|
||||
MachineBasicBlock::const_instr_iterator I = ++MI->getIterator();
|
||||
|
|
Loading…
Reference in New Issue