summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichel Danzer <michel.daenzer@amd.com>2016-03-16 09:10:42 +0000
committerMichel Danzer <michel.daenzer@amd.com>2016-03-16 09:10:42 +0000
commit302f83ac4e5ba37d9b116867ba6a537b0f0adb9a (patch)
treed3f3e021f210620a877b519cdb68ac52b60a0e49
parentbeb79ceb197ad92e788797292578d59bc2bd9a0c (diff)
downloadbcm5719-llvm-302f83ac4e5ba37d9b116867ba6a537b0f0adb9a.tar.gz
bcm5719-llvm-302f83ac4e5ba37d9b116867ba6a537b0f0adb9a.zip
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
-rw-r--r--llvm/lib/Target/AMDGPU/AMDGPUMCInstLower.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUMCInstLower.cpp b/llvm/lib/Target/AMDGPU/AMDGPUMCInstLower.cpp
index dfc652f31da..929cf875aab 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUMCInstLower.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUMCInstLower.cpp
@@ -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();
OpenPOWER on IntegriCloud